diff options
Diffstat (limited to 'spec/lib/gitlab/ci/build/context/build_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/build/context/build_spec.rb | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/spec/lib/gitlab/ci/build/context/build_spec.rb b/spec/lib/gitlab/ci/build/context/build_spec.rb index 6047eb1b1e0..fae02e140f2 100644 --- a/spec/lib/gitlab/ci/build/context/build_spec.rb +++ b/spec/lib/gitlab/ci/build/context/build_spec.rb @@ -4,7 +4,13 @@ require 'spec_helper' RSpec.describe Gitlab::Ci::Build::Context::Build, feature_category: :pipeline_composition do let(:pipeline) { create(:ci_pipeline) } - let(:seed_attributes) { { 'name' => 'some-job' } } + let(:seed_attributes) do + { + name: 'some-job', + tag_list: %w[ruby docker postgresql], + needs_attributes: [{ name: 'setup-test-env', artifacts: true, optional: false }] + } + end subject(:context) { described_class.new(pipeline, seed_attributes) } @@ -23,7 +29,7 @@ RSpec.describe Gitlab::Ci::Build::Context::Build, feature_category: :pipeline_co end context 'when environment:name is provided' do - let(:seed_attributes) { { 'name' => 'some-job', 'environment' => 'test' } } + let(:seed_attributes) { { name: 'some-job', environment: 'test' } } it { is_expected.to include('CI_ENVIRONMENT_NAME' => 'test') } end @@ -35,6 +41,16 @@ RSpec.describe Gitlab::Ci::Build::Context::Build, feature_category: :pipeline_co it { expect(context.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) } it_behaves_like 'variables collection' + + context 'with FF disabled' do + before do + stub_feature_flags(reduced_build_attributes_list_for_rules: false) + end + + it { expect(context.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) } + + it_behaves_like 'variables collection' + end end describe '#variables_hash' do @@ -43,5 +59,15 @@ RSpec.describe Gitlab::Ci::Build::Context::Build, feature_category: :pipeline_co it { expect(context.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) } it_behaves_like 'variables collection' + + context 'with FF disabled' do + before do + stub_feature_flags(reduced_build_attributes_list_for_rules: false) + end + + it { expect(context.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) } + + it_behaves_like 'variables collection' + end end end |