diff --git a/test/unit/model_test.rb b/test/unit/model_test.rb index 8ec188acf..482c4b62f 100644 --- a/test/unit/model_test.rb +++ b/test/unit/model_test.rb @@ -5,73 +5,73 @@ class ModelTest < ActiveSupport::TestCase test 'references test' do # create base - groups = Group.where( name: 'Users' ) - roles = Role.where( name: %w(Agent Admin) ) - agent1 = User.create_or_update( - login: 'model-agent1@example.com', - firstname: 'Model', - lastname: 'Agent1', - email: 'model-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, - ) - organization1 = Organization.create_if_not_exists( - name: 'Model Org 1', - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, - ) - organization2 = Organization.create_if_not_exists( - name: 'Model Org 2', - updated_at: '2015-02-05 16:37:00', - updated_by_id: agent1.id, - created_by_id: 1, - ) - roles = Role.where( name: 'Customer' ) - customer1 = User.create_or_update( - login: 'model-customer1@example.com', - firstname: 'Model', - lastname: 'Customer1', - email: 'model-customer1@example.com', - password: 'customerpw', - active: true, - organization_id: organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, - ) - customer2 = User.create_or_update( - login: 'model-customer2@example.com', - firstname: 'Model', - lastname: 'Customer2', - email: 'model-customer2@example.com', - password: 'customerpw', - active: true, - organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: agent1.id, - created_by_id: 1, - ) - customer3 = User.create_or_update( - login: 'model-customer3@example.com', - firstname: 'Model', - lastname: 'Customer3', - email: 'model-customer3@example.com', - password: 'customerpw', - active: true, - organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: agent1.id, - created_by_id: agent1.id, - ) + groups = Group.where( name: 'Users' ) + roles = Role.where( name: %w(Agent Admin) ) + agent1 = User.create_or_update( + login: 'model-agent1@example.com', + firstname: 'Model', + lastname: 'Agent1', + email: 'model-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, + ) + organization1 = Organization.create_if_not_exists( + name: 'Model Org 1', + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, + ) + organization2 = Organization.create_if_not_exists( + name: 'Model Org 2', + updated_at: '2015-02-05 16:37:00', + updated_by_id: agent1.id, + created_by_id: 1, + ) + roles = Role.where( name: 'Customer' ) + customer1 = User.create_or_update( + login: 'model-customer1@example.com', + firstname: 'Model', + lastname: 'Customer1', + email: 'model-customer1@example.com', + password: 'customerpw', + active: true, + organization_id: organization1.id, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, + ) + customer2 = User.create_or_update( + login: 'model-customer2@example.com', + firstname: 'Model', + lastname: 'Customer2', + email: 'model-customer2@example.com', + password: 'customerpw', + active: true, + organization_id: nil, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: agent1.id, + created_by_id: 1, + ) + customer3 = User.create_or_update( + login: 'model-customer3@example.com', + firstname: 'Model', + lastname: 'Customer3', + email: 'model-customer3@example.com', + password: 'customerpw', + active: true, + organization_id: nil, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: agent1.id, + created_by_id: agent1.id, + ) references = Models.references('User', agent1.id)