remove company creation validation

This commit is contained in:
oleghasjanov 2024-11-25 14:48:28 +02:00
parent d23b66e859
commit d0a39bf469
3 changed files with 38 additions and 61 deletions

View file

@ -188,39 +188,39 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
ENV['shunter_enabled'] = 'false'
end
def test_returns_error_response_if_company_not_existed
original_new_method = CompanyRegister::Client.method(:new)
CompanyRegister::Client.define_singleton_method(:new) do
object = original_new_method.call
def object.simple_data(registration_number:)
[Company.new('1234567', 'ACME Ltd', 'K')]
end
object
end
# def test_returns_error_response_if_company_not_existed
# original_new_method = CompanyRegister::Client.method(:new)
# CompanyRegister::Client.define_singleton_method(:new) do
# object = original_new_method.call
# def object.simple_data(registration_number:)
# [Company.new('1234567', 'ACME Ltd', 'K')]
# end
# object
# end
request_body = {
"contact": {
"name": 'Donald Trump',
"phone": '+372.51111112',
"email": 'donald@trumptower.com',
"ident": {
"ident_type": 'org',
"ident_country_code": 'EE',
"ident": '70000313',
},
},
}
# request_body = {
# "contact": {
# "name": 'Donald Trump',
# "phone": '+372.51111112',
# "email": 'donald@trumptower.com',
# "ident": {
# "ident_type": 'org',
# "ident_country_code": 'EE',
# "ident": '70000313',
# },
# },
# }
post '/repp/v1/contacts', headers: @auth_headers, params: request_body
json = JSON.parse(response.body, symbolize_names: true)
# post '/repp/v1/contacts', headers: @auth_headers, params: request_body
# json = JSON.parse(response.body, symbolize_names: true)
assert_response :bad_request
assert_equal 2003, json[:code]
puts json[:message]
assert json[:message].include? 'Company is not registered'
# assert_response :bad_request
# assert_equal 2003, json[:code]
# puts json[:message]
# assert json[:message].include? 'Company is not registered'
CompanyRegister::Client.define_singleton_method(:new, original_new_method)
end
# CompanyRegister::Client.define_singleton_method(:new, original_new_method)
# end
def test_contact_created_with_existed_company
original_new_method = CompanyRegister::Client.method(:new)