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
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-07-14 20:43:26 +0300
committerLin Jen-Shin <godfat@godfat.org>2017-07-14 20:43:26 +0300
commit0fd4a6b637e30adc9855e7cea1c53c4767fcefcb (patch)
tree9588f7bb7a6b757410c31512dec65558a7329912 /spec/support/matchers
parent0f393724e7de8d764577b6622ccf43964539cb2b (diff)
Introduce have_gitlab_http_status
So that whenever this failed: expect(response).to have_gitlab_http_status(200) We see what's the response there. Here's an example: ``` 1) API::Settings Settings PUT /application/settings custom repository storage type set in the config updates application settings Failure/Error: expect(response).to have_gitlab_http_status(200) expected the response to have status code 200 but it was 400. The response was: {"error":"password_authentication_enabled, signin_enabled are mutually exclusive"} ```
Diffstat (limited to 'spec/support/matchers')
-rw-r--r--spec/support/matchers/have_gitlab_http_status.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/support/matchers/have_gitlab_http_status.rb b/spec/support/matchers/have_gitlab_http_status.rb
new file mode 100644
index 00000000000..3198f1b9edd
--- /dev/null
+++ b/spec/support/matchers/have_gitlab_http_status.rb
@@ -0,0 +1,14 @@
+RSpec::Matchers.define :have_gitlab_http_status do |expected|
+ match do |actual|
+ expect(actual).to have_http_status(expected)
+ end
+
+ description do
+ "respond with numeric status code #{expected}"
+ end
+
+ failure_message do |actual|
+ "expected the response to have status code #{expected.inspect}" \
+ " but it was #{actual.response_code}. The response was: #{actual.body}"
+ end
+end