summaryrefslogtreecommitdiff
path: root/spec/support/matchers/have_gitlab_http_status.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/matchers/have_gitlab_http_status.rb')
-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