diff options
author | Stan Hu <stanhu@gmail.com> | 2017-12-02 22:55:49 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-12-12 15:07:23 -0800 |
commit | 8e7f19c60bea4eec86844be1e0db12ebf30f105e (patch) | |
tree | a86172a9287a4e85900236e3007408d7a8ae2fc2 /spec/controllers/projects | |
parent | ad1ce1238e8adfb1d10529a99ffd2b298bde3fb5 (diff) | |
download | gitlab-ce-8e7f19c60bea4eec86844be1e0db12ebf30f105e.tar.gz |
Add button to run scheduled pipeline immediately
Closes #38741
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r-- | spec/controllers/projects/pipeline_schedules_controller_spec.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/controllers/projects/pipeline_schedules_controller_spec.rb b/spec/controllers/projects/pipeline_schedules_controller_spec.rb index 4e52e261920..384a407a100 100644 --- a/spec/controllers/projects/pipeline_schedules_controller_spec.rb +++ b/spec/controllers/projects/pipeline_schedules_controller_spec.rb @@ -96,7 +96,7 @@ describe Projects::PipelineSchedulesController do end end - context 'when variables_attributes has two variables and duplicted' do + context 'when variables_attributes has two variables and duplicated' do let(:schedule) do basic_param.merge({ variables_attributes: [{ key: 'AAA', value: 'AAA123' }, { key: 'AAA', value: 'BBB123' }] @@ -364,6 +364,30 @@ describe Projects::PipelineSchedulesController do end end + describe 'POST #run' do + set(:user) { create(:user) } + + context 'when a developer makes the request' do + before do + project.add_developer(user) + sign_in(user) + end + + it 'executes a new pipeline' do + expect(RunPipelineScheduleWorker).to receive(:perform_async).with(pipeline_schedule.id, user.id).and_return('job-123') + + go + + expect(flash[:notice]).to eq 'Successfully scheduled pipeline to run immediately' + expect(response).to have_gitlab_http_status(302) + end + end + + def go + post :run, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id + end + end + describe 'DELETE #destroy' do set(:user) { create(:user) } |