diff options
author | Zsolt Kovari <zsolt.kovari@cern.ch> | 2019-06-16 17:57:38 +0200 |
---|---|---|
committer | Zsolt Kovari <zsolt.kovari@cern.ch> | 2019-06-16 17:57:38 +0200 |
commit | 0a6a0a5280828e06323aed1614fdbd99984616aa (patch) | |
tree | 2c497378d699956ac8e6737a48db2129cb5837e3 /spec/requests | |
parent | 07cb81a31efbee2c9a4cfacadb2967e189f1447a (diff) | |
download | gitlab-ce-0a6a0a5280828e06323aed1614fdbd99984616aa.tar.gz |
56737 Expose currently supported events properly on services API
Diffstat (limited to 'spec/requests')
-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 |