diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-07 18:09:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-07 18:09:56 +0300 |
commit | 79f98200f84590af39cf1af7f57f6e8ba89d2bb6 (patch) | |
tree | 289fadec4d3f96a681b3938debaf3800806471ff /spec/lib | |
parent | de8e5077c3671b0b29642faf1b5e562bc4f99453 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/ci/yaml_processor/result_spec.rb | 24 | ||||
-rw-r--r-- | spec/lib/gitlab/data_builder/build_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/data_builder/pipeline_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/markdown_cache/field_data_spec.rb | 7 |
4 files changed, 30 insertions, 5 deletions
diff --git a/spec/lib/gitlab/ci/yaml_processor/result_spec.rb b/spec/lib/gitlab/ci/yaml_processor/result_spec.rb index a0a79dcad36..25705fd4260 100644 --- a/spec/lib/gitlab/ci/yaml_processor/result_spec.rb +++ b/spec/lib/gitlab/ci/yaml_processor/result_spec.rb @@ -54,14 +54,22 @@ module Gitlab YAML end - subject(:yaml_variables_for) { result.yaml_variables_for(:job) } + let(:job_name) { :job } - it do + subject(:yaml_variables_for) { result.yaml_variables_for(job_name) } + + it 'returns calculated variables with root and job variables' do is_expected.to match_array([ { key: 'VAR1', value: 'value 11', public: true }, { key: 'VAR2', value: 'value 2', public: true } ]) end + + context 'when an absent job is sent' do + let(:job_name) { :invalid_job } + + it { is_expected.to eq([]) } + end end describe '#stage_for' do @@ -72,10 +80,16 @@ module Gitlab YAML end - subject(:stage_for) { result.stage_for(:job) } + let(:job_name) { :job } + + subject(:stage_for) { result.stage_for(job_name) } + + it { is_expected.to eq('test') } + + context 'when an absent job is sent' do + let(:job_name) { :invalid_job } - it do - is_expected.to eq('test') + it { is_expected.to be_nil } end end end diff --git a/spec/lib/gitlab/data_builder/build_spec.rb b/spec/lib/gitlab/data_builder/build_spec.rb index a31e5a1d1e2..325fdb90929 100644 --- a/spec/lib/gitlab/data_builder/build_spec.rb +++ b/spec/lib/gitlab/data_builder/build_spec.rb @@ -47,6 +47,8 @@ RSpec.describe Gitlab::DataBuilder::Build do it { expect(data[:runner][:id]).to eq(build.runner.id) } it { expect(data[:runner][:tags]).to match_array(tag_names) } it { expect(data[:runner][:description]).to eq(build.runner.description) } + it { expect(data[:runner][:runner_type]).to eq(build.runner.runner_type) } + it { expect(data[:runner][:is_shared]).to eq(build.runner.instance_type?) } it { expect(data[:environment]).to be_nil } context 'commit author_url' do diff --git a/spec/lib/gitlab/data_builder/pipeline_spec.rb b/spec/lib/gitlab/data_builder/pipeline_spec.rb index bec1e612c02..c05a044f0de 100644 --- a/spec/lib/gitlab/data_builder/pipeline_spec.rb +++ b/spec/lib/gitlab/data_builder/pipeline_spec.rb @@ -58,8 +58,10 @@ RSpec.describe Gitlab::DataBuilder::Pipeline do it 'has runner attributes', :aggregate_failures do expect(runner_data[:id]).to eq(ci_runner.id) expect(runner_data[:description]).to eq(ci_runner.description) + expect(runner_data[:runner_type]).to eq(ci_runner.runner_type) expect(runner_data[:active]).to eq(ci_runner.active) expect(runner_data[:tags]).to match_array(tag_names) + expect(runner_data[:is_shared]).to eq(ci_runner.instance_type?) end end diff --git a/spec/lib/gitlab/markdown_cache/field_data_spec.rb b/spec/lib/gitlab/markdown_cache/field_data_spec.rb index 76d8cbe6b7d..6d4b57254f2 100644 --- a/spec/lib/gitlab/markdown_cache/field_data_spec.rb +++ b/spec/lib/gitlab/markdown_cache/field_data_spec.rb @@ -12,4 +12,11 @@ RSpec.describe Gitlab::MarkdownCache::FieldData do it 'translates a markdown field name into a html field name' do expect(field_data.html_field(:description)).to eq("description_html") end + + describe '#key?' do + specify do + expect(field_data.key?(:description)).to be_truthy + expect(field_data.key?(:something_else)).to be_falsy + end + end end |