mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 05:26:17 +02:00
Updated dependency ransack to v4
This commit is contained in:
parent
a78f5b901f
commit
37c16a067d
16 changed files with 139 additions and 36 deletions
|
@ -8,12 +8,12 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
|||
|
||||
@auth_headers = { 'Authorization' => token }
|
||||
|
||||
adapter = ENV["shunter_default_adapter"].constantize.new
|
||||
adapter = ENV['shunter_default_adapter'].constantize.new
|
||||
adapter&.clear!
|
||||
end
|
||||
|
||||
def test_creates_new_contact
|
||||
request_body = {
|
||||
request_body = {
|
||||
contact: {
|
||||
name: 'Donald Trump',
|
||||
phone: '+372.51111112',
|
||||
|
@ -60,8 +60,8 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
|||
street: 'Wismari 13',
|
||||
zip: '12345',
|
||||
country_code: 'EE',
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
post '/repp/v1/contacts', headers: @auth_headers, params: request_body
|
||||
|
@ -83,17 +83,17 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
|||
def test_requires_contact_address_when_processing_enabled
|
||||
Setting.address_processing = true
|
||||
|
||||
request_body = {
|
||||
request_body = {
|
||||
"contact": {
|
||||
"name": "Donald Trump",
|
||||
"phone": "+372.51111112",
|
||||
"email": "donald@trumptower.com",
|
||||
"name": 'Donald Trump',
|
||||
"phone": '+372.51111112',
|
||||
"email": 'donald@trumptower.com',
|
||||
"ident": {
|
||||
"ident_type": "priv",
|
||||
"ident_country_code": "EE",
|
||||
"ident": "39708290069"
|
||||
}
|
||||
}
|
||||
'ident_type': 'priv',
|
||||
'ident_country_code': 'EE',
|
||||
'ident': '39708290069',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
post '/repp/v1/contacts', headers: @auth_headers, params: request_body
|
||||
|
@ -107,17 +107,17 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_validates_ident_code
|
||||
request_body = {
|
||||
request_body = {
|
||||
"contact": {
|
||||
"name": "Donald Trump",
|
||||
"phone": "+372.51111112",
|
||||
"email": "donald@trumptower.com",
|
||||
"name": 'Donald Trump',
|
||||
"phone": '+372.51111112',
|
||||
"email": 'donald@trumptower.com',
|
||||
"ident": {
|
||||
"ident_type": "priv",
|
||||
"ident_country_code": "EE",
|
||||
"ident": "123123123"
|
||||
}
|
||||
}
|
||||
"ident_type": 'priv',
|
||||
"ident_country_code": 'EE',
|
||||
"ident": '123123123',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
post '/repp/v1/contacts', headers: @auth_headers, params: request_body
|
||||
|
@ -158,10 +158,10 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_returns_error_response_if_throttled
|
||||
ENV["shunter_default_threshold"] = '1'
|
||||
ENV["shunter_enabled"] = 'true'
|
||||
ENV['shunter_default_threshold'] = '1'
|
||||
ENV['shunter_enabled'] = 'true'
|
||||
|
||||
request_body = {
|
||||
request_body = {
|
||||
contact: {
|
||||
name: 'Donald Trump',
|
||||
phone: '+372.51111112',
|
||||
|
@ -181,7 +181,7 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
|||
assert_response :bad_request
|
||||
assert_equal json[:code], 2502
|
||||
assert response.body.include?(Shunter.default_error_message)
|
||||
ENV["shunter_default_threshold"] = '10000'
|
||||
ENV["shunter_enabled"] = 'false'
|
||||
ENV['shunter_default_threshold'] = '10000'
|
||||
ENV['shunter_enabled'] = 'false'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue