Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorZsolt Kovari <zsolt.kovari@cern.ch>2019-06-16 18:57:38 +0300
committerZsolt Kovari <zsolt.kovari@cern.ch>2019-06-16 18:57:38 +0300
commit0a6a0a5280828e06323aed1614fdbd99984616aa (patch)
tree2c497378d699956ac8e6737a48db2129cb5837e3 /spec
parent07cb81a31efbee2c9a4cfacadb2967e189f1447a (diff)
56737 Expose currently supported events properly on services API
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/services_spec.rb17
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