Upgrade to Rails 5.0

Closes #377
This commit is contained in:
Artur Beljajev 2019-09-15 15:38:52 +03:00
parent bb108efedd
commit fa52001be6
141 changed files with 1388 additions and 1664 deletions

View file

@ -14,18 +14,19 @@ class RegistrantApiContactsTest < ApplicationIntegrationTest
contacts(:william).update!(ident: '1234', ident_type: 'priv', ident_country_code: 'US')
assert_equal 3, @user.contacts.size
get '/api/v1/registrant/contacts', { 'limit' => 1, 'offset' => 0 }, @auth_headers
get '/api/v1/registrant/contacts', params: { 'limit' => 1, 'offset' => 0 },
headers: @auth_headers
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal(200, response.status)
assert_equal(1, response_json.count)
get '/api/v1/registrant/contacts', {}, @auth_headers
get '/api/v1/registrant/contacts', headers: @auth_headers
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal(3, response_json.count)
end
def test_get_contact_details_by_uuid
get api_v1_registrant_contact_path(@contact.uuid), nil, @auth_headers
get api_v1_registrant_contact_path(@contact.uuid), headers: @auth_headers
assert_response :ok
response_json = JSON.parse(response.body, symbolize_names: true)
@ -33,21 +34,23 @@ class RegistrantApiContactsTest < ApplicationIntegrationTest
end
def test_root_does_not_accept_limit_higher_than_200
get '/api/v1/registrant/contacts', { 'limit' => 400, 'offset' => 0 }, @auth_headers
get '/api/v1/registrant/contacts', params: { 'limit' => 400, 'offset' => 0 },
headers: @auth_headers
assert_equal(400, response.status)
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal({ errors: [{ limit: ['parameter is out of range'] }] }, response_json)
end
def test_root_does_not_accept_offset_lower_than_0
get '/api/v1/registrant/contacts', { 'limit' => 200, 'offset' => "-10" }, @auth_headers
get '/api/v1/registrant/contacts', params: { 'limit' => 200, 'offset' => "-10" },
headers: @auth_headers
assert_equal(400, response.status)
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal({ errors: [{ offset: ['parameter is out of range'] }] }, response_json)
end
def test_root_returns_401_without_authorization
get '/api/v1/registrant/contacts', {}, {}
get '/api/v1/registrant/contacts'
assert_equal(401, response.status)
json_body = JSON.parse(response.body, symbolize_names: true)