diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-07-27 17:33:06 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-07-27 17:33:06 +0300 |
commit | caad9334a7b9c0c7a6356418f0d7018919e7d09a (patch) | |
tree | 3b81224fd33afe0ae252f3d8f6dcc9f92b4e612b /spec/support | |
parent | 0ed42f4b3534e652c91e6628c43e09be67423301 (diff) | |
parent | 4e3e0dc8d4d742e388372e969324483ab51a3363 (diff) |
Merge branch 'rc/fix-branches-api-endpoint' into 'master'
Fix the `/projects/:id/repository/branches endpoint` to handle dots in the branch name when the project full patch contains a `/`
See merge request !13115
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/api/schema_matcher.rb | 9 | ||||
-rw-r--r-- | spec/support/shared_examples/requests/api/status_shared_examples.rb (renamed from spec/support/api/status_shared_examples.rb) | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/spec/support/api/schema_matcher.rb b/spec/support/api/schema_matcher.rb index dff0dfba675..67599f77adb 100644 --- a/spec/support/api/schema_matcher.rb +++ b/spec/support/api/schema_matcher.rb @@ -5,7 +5,14 @@ end RSpec::Matchers.define :match_response_schema do |schema, **options| match do |response| - JSON::Validator.validate!(schema_path(schema), response.body, options) + @errors = JSON::Validator.fully_validate(schema_path(schema), response.body, options) + + @errors.empty? + end + + failure_message do |response| + "didn't match the schema defined by #{schema_path(schema)}" \ + " The validation errors were:\n#{@errors.join("\n")}" end end diff --git a/spec/support/api/status_shared_examples.rb b/spec/support/shared_examples/requests/api/status_shared_examples.rb index 3481749a7f0..226277411d6 100644 --- a/spec/support/api/status_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/status_shared_examples.rb @@ -9,7 +9,7 @@ shared_examples_for '400 response' do end it 'returns 400' do - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end end @@ -20,7 +20,7 @@ shared_examples_for '403 response' do end it 'returns 403' do - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end @@ -32,7 +32,7 @@ shared_examples_for '404 response' do end it 'returns 404' do - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) expect(json_response).to be_an Object if message.present? |