diff options
author | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-05-27 16:22:33 +0300 |
---|---|---|
committer | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-05-30 17:55:09 +0300 |
commit | 63ca126e977666335d7e5f70665815d1289a6f34 (patch) | |
tree | 17fe03f66ba740d4497bab2f8fb1a2c31580512a /spec/requests | |
parent | b17c8d67d8811e0a440338dc25464d8c90e81179 (diff) |
Improve API with optinal and default. Allow to use scope as a parameter.
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/pipeline_schedules_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/requests/api/pipeline_schedules_spec.rb b/spec/requests/api/pipeline_schedules_spec.rb index 74de2f0ba4a..77bf377884d 100644 --- a/spec/requests/api/pipeline_schedules_spec.rb +++ b/spec/requests/api/pipeline_schedules_spec.rb @@ -43,6 +43,24 @@ describe API::PipelineSchedules do get api("/projects/#{project.id}/pipeline_schedules", developer) end.not_to exceed_query_limit(control_count) end + + %w[active inactive].each do |target| + context "when scope is #{target}" do + before do + create(:ci_pipeline_schedule, project: project, active: active?(target)) + end + + it 'returns matched pipeline schedules' do + get api("/projects/#{project.id}/pipeline_schedules", developer), scope: target + + expect(json_response.map{ |r| r['active'] }).to all(eq(active?(target))) + end + end + + def active?(str) + (str == 'active') ? true : false + end + end end context 'authenticated user with invalid permissions' do |