mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Refactor common part of the find_or_create_by_x into a private method
This commit is contained in:
parent
75119aff2e
commit
f92ece5467
3 changed files with 53 additions and 29 deletions
|
@ -20,6 +20,19 @@ class RegistrantUserTest < ActiveSupport::TestCase
|
|||
assert_equal('JOHN SMITH', user.username)
|
||||
end
|
||||
|
||||
def test_find_or_create_by_api_data_creates_a_user_after_upcasing_input
|
||||
user_data = {
|
||||
ident: '37710100070',
|
||||
first_name: 'John',
|
||||
last_name: 'Smith'
|
||||
}
|
||||
|
||||
RegistrantUser.find_or_create_by_api_data(user_data)
|
||||
|
||||
user = User.find_by(registrant_ident: 'EE-37710100070')
|
||||
assert_equal('JOHN SMITH', user.username)
|
||||
end
|
||||
|
||||
def test_find_or_create_by_mid_data_creates_a_user
|
||||
user_data = OpenStruct.new(user_country: 'EE', user_id_code: '37710100070',
|
||||
user_givenname: 'JOHN', user_surname: 'SMITH')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue