Updated dependency ransack to v4

This commit is contained in:
Sergei Tsoganov 2023-03-16 11:28:25 +02:00
parent a78f5b901f
commit 37c16a067d
16 changed files with 139 additions and 36 deletions

View file

@ -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