diff options
author | Stan Hu <stanhu@gmail.com> | 2019-06-17 22:43:50 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-06-17 22:43:50 +0000 |
commit | 7c27155c453f4cc4382424bbd1d84813a2c86b10 (patch) | |
tree | 7ded8752e87ba1f015c10b7dfe45359659b91d7e /spec/requests/api | |
parent | 12d262c23f5a783106c08cd385ecb86ccb4b899c (diff) | |
parent | 4a71db7b3d30922d9d5f8015f54d45dee0ffc60e (diff) | |
download | gitlab-ce-7c27155c453f4cc4382424bbd1d84813a2c86b10.tar.gz |
Merge branch '56737-commits-and-mr-events-on-jira-api' into 'master'
Expose currently supported events properly on services API
Closes #56737
See merge request gitlab-org/gitlab-ce!29736
Diffstat (limited to 'spec/requests/api')
-rw-r--r-- | spec/requests/api/services_spec.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/requests/api/services_spec.rb b/spec/requests/api/services_spec.rb index e260aa21e25..8065c077ca0 100644 --- a/spec/requests/api/services_spec.rb +++ b/spec/requests/api/services_spec.rb @@ -19,13 +19,22 @@ describe API::Services do expect(response).to have_gitlab_http_status(200) current_service = project.services.first - event = current_service.event_names.empty? ? "foo" : current_service.event_names.first - state = current_service[event] || false + events = current_service.event_names.empty? ? ["foo"].freeze : current_service.event_names + query_strings = [] + events.each do |event| + query_strings << "#{event}=#{!current_service[event]}" + end + query_strings = query_strings.join('&') - put api("/projects/#{project.id}/services/#{dashed_service}?#{event}=#{!state}", user), params: service_attrs + put api("/projects/#{project.id}/services/#{dashed_service}?#{query_strings}", user), params: service_attrs expect(response).to have_gitlab_http_status(200) - expect(project.services.first[event]).not_to eq(state) unless event == "foo" + events.each do |event| + next if event == "foo" + + expect(project.services.first[event]).not_to eq(current_service[event]), + "expected #{!current_service[event]} for event #{event} for service #{current_service.title}, got #{current_service[event]}" + end end it "returns if required fields missing" do |