diff options
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry/product/matrix_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/product/matrix_spec.rb | 128 |
1 files changed, 26 insertions, 102 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/product/matrix_spec.rb b/spec/lib/gitlab/ci/config/entry/product/matrix_spec.rb index 3388ae0af2f..ff44a235ea5 100644 --- a/spec/lib/gitlab/ci/config/entry/product/matrix_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/product/matrix_spec.rb @@ -46,98 +46,53 @@ RSpec.describe ::Gitlab::Ci::Config::Entry::Product::Matrix do end end - context 'with one_dimensional_matrix feature flag enabled' do - before do - stub_feature_flags(one_dimensional_matrix: true) - matrix.compose! + context 'when entry config has only one variable with multiple values' do + let(:config) do + [ + { + 'VAR_1' => %w[build test] + } + ] end - context 'when entry config has only one variable with multiple values' do - let(:config) do - [ - { - 'VAR_1' => %w[build test] - } - ] - end - - describe '#valid?' do - it { is_expected.to be_valid } - end + describe '#valid?' do + it { is_expected.to be_valid } + end - describe '#errors' do - it 'returns no errors' do - expect(matrix.errors) - .to be_empty - end + describe '#errors' do + it 'returns no errors' do + expect(matrix.errors) + .to be_empty end + end - describe '#value' do - before do - matrix.compose! - end - - it 'returns the value without raising an error' do - expect(matrix.value).to eq([{ 'VAR_1' => %w[build test] }]) - end + describe '#value' do + before do + matrix.compose! end - context 'when entry config has only one variable with one value' do - let(:config) do - [ - { - 'VAR_1' => %w[test] - } - ] - end - - describe '#valid?' do - it { is_expected.to be_valid } - end - - describe '#errors' do - it 'returns no errors' do - expect(matrix.errors) - .to be_empty - end - end - - describe '#value' do - before do - matrix.compose! - end - - it 'returns the value without raising an error' do - expect(matrix.value).to eq([{ 'VAR_1' => %w[test] }]) - end - end + it 'returns the value without raising an error' do + expect(matrix.value).to eq([{ 'VAR_1' => %w[build test] }]) end end - end - context 'with one_dimensional_matrix feature flag disabled' do - before do - stub_feature_flags(one_dimensional_matrix: false) - matrix.compose! - end - - context 'when entry config has only one variable with multiple values' do + context 'when entry config has only one variable with one value' do let(:config) do [ { - 'VAR_1' => %w[build test] + 'VAR_1' => %w[test] } ] end describe '#valid?' do - it { is_expected.not_to be_valid } + it { is_expected.to be_valid } end describe '#errors' do - it 'returns error about too many jobs' do + it 'returns no errors' do expect(matrix.errors) - .to include('variables config requires at least 2 items') + .to be_empty end end @@ -147,38 +102,7 @@ RSpec.describe ::Gitlab::Ci::Config::Entry::Product::Matrix do end it 'returns the value without raising an error' do - expect(matrix.value).to eq([{ 'VAR_1' => %w[build test] }]) - end - end - - context 'when entry config has only one variable with one value' do - let(:config) do - [ - { - 'VAR_1' => %w[test] - } - ] - end - - describe '#valid?' do - it { is_expected.not_to be_valid } - end - - describe '#errors' do - it 'returns no errors' do - expect(matrix.errors) - .to include('variables config requires at least 2 items') - end - end - - describe '#value' do - before do - matrix.compose! - end - - it 'returns the value without raising an error' do - expect(matrix.value).to eq([{ 'VAR_1' => %w[test] }]) - end + expect(matrix.value).to eq([{ 'VAR_1' => %w[test] }]) end end end |