diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-07-06 01:00:54 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-07-06 01:00:54 +0900 |
commit | 60425c2309be01a05a49c841ed1daef26199d95d (patch) | |
tree | 6d1ad6125374b13043ef8a2b1615370721aac98e /spec/controllers | |
parent | 9a9aaa564a0873fc4b5f4fc8ee01636fb824e628 (diff) | |
download | gitlab-ce-60425c2309be01a05a49c841ed1daef26199d95d.tar.gz |
Reduce less meaningful test suits from pipeline_schedules_controller_spec.rb
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/pipeline_schedules_controller_spec.rb | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/spec/controllers/projects/pipeline_schedules_controller_spec.rb b/spec/controllers/projects/pipeline_schedules_controller_spec.rb index 5dff41df9c0..d28dd1e3e48 100644 --- a/spec/controllers/projects/pipeline_schedules_controller_spec.rb +++ b/spec/controllers/projects/pipeline_schedules_controller_spec.rb @@ -75,18 +75,6 @@ describe Projects::PipelineSchedulesController do attributes_for(:ci_pipeline_schedule) end - context 'when variables_attributes is empty' do - let(:schedule) { basic_param } - - it 'creates a new schedule' do - expect { go } - .to change { Ci::PipelineSchedule.count }.by(1) - .and change { Ci::PipelineScheduleVariable.count }.by(0) - - expect(response).to have_http_status(:found) - end - end - context 'when variables_attributes has one variable' do let(:schedule) do basic_param.merge({ @@ -106,57 +94,6 @@ describe Projects::PipelineSchedulesController do expect(v.value).to eq("AAA123") end end - - context 'when the same key has already been persisted' do - it 'returns an error that the key of variable is invaild' do - go - - pipeline_schedule_variable = build(:ci_pipeline_schedule_variable, key: 'AAA', pipeline_schedule: assigns(:schedule)) - expect(pipeline_schedule_variable).to be_invalid - end - end - end - - context 'when variables_attributes has one variable and key is empty' do - let(:schedule) do - basic_param.merge({ - variables_attributes: [{ key: '', value: 'AAA123' }] - }) - end - - it 'returns an error that the key of variable is invaild' do - expect { go } - .to change { Ci::PipelineSchedule.count }.by(0) - .and change { Ci::PipelineScheduleVariable.count }.by(0) - - expect(assigns(:schedule).errors['variables.key']).not_to be_empty - end - end - - context 'when variables_attributes has two variables and unique' do - let(:schedule) do - basic_param.merge({ - variables_attributes: [{ key: 'AAA', value: 'AAA123' }, { key: 'BBB', value: 'BBB123' }] - }) - end - - it 'creates a new schedule' do - expect { go } - .to change { Ci::PipelineSchedule.count }.by(1) - .and change { Ci::PipelineScheduleVariable.count }.by(2) - - expect(response).to have_http_status(:found) - - Ci::PipelineScheduleVariable.first.tap do |v| - expect(v.key).to eq("AAA") - expect(v.value).to eq("AAA123") - end - - Ci::PipelineScheduleVariable.last.tap do |v| - expect(v.key).to eq("BBB") - expect(v.value).to eq("BBB123") - end - end end context 'when variables_attributes has two variables and duplicted' do @@ -210,19 +147,6 @@ describe Projects::PipelineSchedulesController do { description: 'updated_desc', cron: '0 1 * * *', cron_timezone: 'UTC', ref: 'patch-x', active: true } end - context 'when params do not include variables' do - let(:schedule) { basic_param } - - it 'updates only scheduled pipeline attributes' do - go - - pipeline_schedule.reload - expect(response).to have_http_status(:found) - expect(pipeline_schedule).to have_attributes(basic_param) - expect(pipeline_schedule.variables).to be_empty - end - end - context 'when params include one variable' do let(:schedule) do basic_param.merge({ @@ -240,25 +164,6 @@ describe Projects::PipelineSchedulesController do end end - context 'when params include two unique variables' do - let(:schedule) do - basic_param.merge({ - variables_attributes: [{ key: 'AAA', value: 'AAA123' }, { key: 'BBB', value: 'BBB123' }] - }) - end - - it 'inserts two new variables to the pipeline schedule' do - expect { go }.to change { Ci::PipelineScheduleVariable.count }.by(2) - - pipeline_schedule.reload - expect(response).to have_http_status(:found) - expect(pipeline_schedule.variables.first.key).to eq('AAA') - expect(pipeline_schedule.variables.first.value).to eq('AAA123') - expect(pipeline_schedule.variables.last.key).to eq('BBB') - expect(pipeline_schedule.variables.last.value).to eq('BBB123') - end - end - context 'when params include two duplicated variables' do let(:schedule) do basic_param.merge({ @@ -284,19 +189,6 @@ describe Projects::PipelineSchedulesController do key: 'CCC', pipeline_schedule: pipeline_schedule) end - context 'when params do not include variables' do - let(:schedule) { basic_param } - - it 'updates only scheduled pipeline attributes' do - go - - pipeline_schedule.reload - expect(response).to have_http_status(:found) - expect(pipeline_schedule).to have_attributes(basic_param) - expect(pipeline_schedule.variables.last.key).to eq('CCC') - end - end - context 'when params include one variable' do context 'when adds a new variable' do let(:schedule) do |