Commit 683fd52c authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '34964-have_gitlab_http_status' into 'master'

Introduce have_gitlab_http_status

Closes #34964

See merge request !12883
parents 5f32bd77 0fd4a6b6
......@@ -6,7 +6,7 @@ describe API::Version do
it 'returns authentication error' do
get api('/version')
expect(response).to have_http_status(401)
expect(response).to have_gitlab_http_status(401)
end
end
......@@ -16,7 +16,7 @@ describe API::Version do
it 'returns the version information' do
get api('/version', user)
expect(response).to have_http_status(200)
expect(response).to have_gitlab_http_status(200)
expect(json_response['version']).to eq(Gitlab::VERSION)
expect(json_response['revision']).to eq(Gitlab::REVISION)
end
......
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment