diff options
author | Stan Hu <stanhu@gmail.com> | 2017-12-09 15:08:27 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-12-12 15:07:25 -0800 |
commit | ef78f67f4a2e19d204f5f4d4770649be1fe7bee9 (patch) | |
tree | 198ecbb47704b1d1478a9edc198c4eeb5336b124 /spec/controllers | |
parent | 54f13b1ec8542dc5085e0367734e8344c2c3d01e (diff) | |
download | gitlab-ce-ef78f67f4a2e19d204f5f4d4770649be1fe7bee9.tar.gz |
Add a spec for rate limiting pipeline schedules
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/pipeline_schedules_controller_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/controllers/projects/pipeline_schedules_controller_spec.rb b/spec/controllers/projects/pipeline_schedules_controller_spec.rb index 844c62ef005..ffc1259eb8f 100644 --- a/spec/controllers/projects/pipeline_schedules_controller_spec.rb +++ b/spec/controllers/projects/pipeline_schedules_controller_spec.rb @@ -385,6 +385,16 @@ describe Projects::PipelineSchedulesController do expect(flash[:notice]).to start_with 'Successfully scheduled a pipeline to run' expect(response).to have_gitlab_http_status(302) end + + it 'prevents users from scheduling the same pipeline repeatedly' do + 2.times do + post :play, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id + end + + expect(flash.to_a.size).to eq(2) + expect(flash[:alert]).to eq 'You cannot play this scheduled pipeline at the moment. Please wait a minute.' + expect(response).to have_gitlab_http_status(302) + end end context 'when a developer attempts to schedule a protected ref' do |