Fix problems referencing host model classes
This commit is contained in:
@@ -2,7 +2,7 @@ require "test_helper"
|
||||
|
||||
class Signup::AccountNameGeneratorTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@identity = Identity.create!(email_address: "newart.userbaum@example.com")
|
||||
@identity = ::Identity.create!(email_address: "newart.userbaum@example.com")
|
||||
@name = "Newart userbaum"
|
||||
@generator = Signup::AccountNameGenerator.new(identity: @identity, name: @name)
|
||||
end
|
||||
@@ -11,8 +11,8 @@ class Signup::AccountNameGeneratorTest < ActiveSupport::TestCase
|
||||
account_name = @generator.generate
|
||||
assert_equal "Newart's Fizzy", account_name, "The 1st account doesn't have 1st in the name"
|
||||
|
||||
first_account = Account.create!(external_account_id: "1st", name: account_name)
|
||||
Current.without_account do
|
||||
first_account = ::Account.create!(external_account_id: "1st", name: account_name)
|
||||
::Current.without_account do
|
||||
@identity.users.create!(account: first_account, name: @name)
|
||||
@identity.reload
|
||||
end
|
||||
@@ -20,8 +20,8 @@ class Signup::AccountNameGeneratorTest < ActiveSupport::TestCase
|
||||
account_name = @generator.generate
|
||||
assert_equal "Newart's 2nd Fizzy", account_name
|
||||
|
||||
second_account = Account.create!(external_account_id: "2nd", name: account_name)
|
||||
Current.without_account do
|
||||
second_account = ::Account.create!(external_account_id: "2nd", name: account_name)
|
||||
::Current.without_account do
|
||||
@identity.users.create!(account: second_account, name: @name)
|
||||
@identity.reload
|
||||
end
|
||||
@@ -29,8 +29,8 @@ class Signup::AccountNameGeneratorTest < ActiveSupport::TestCase
|
||||
account_name = @generator.generate
|
||||
assert_equal "Newart's 3rd Fizzy", account_name
|
||||
|
||||
third_account = Account.create!(external_account_id: "3rd", name: account_name)
|
||||
Current.without_account do
|
||||
third_account = ::Account.create!(external_account_id: "3rd", name: account_name)
|
||||
::Current.without_account do
|
||||
@identity.users.create!(account: third_account, name: @name)
|
||||
@identity.reload
|
||||
end
|
||||
@@ -38,8 +38,8 @@ class Signup::AccountNameGeneratorTest < ActiveSupport::TestCase
|
||||
account_name = @generator.generate
|
||||
assert_equal "Newart's 4th Fizzy", account_name
|
||||
|
||||
fourth_account = Account.create!(external_account_id: "4th", name: account_name)
|
||||
Current.without_account do
|
||||
fourth_account = ::Account.create!(external_account_id: "4th", name: account_name)
|
||||
::Current.without_account do
|
||||
@identity.users.create!(account: fourth_account, name: @name)
|
||||
@identity.reload
|
||||
end
|
||||
@@ -49,8 +49,8 @@ class Signup::AccountNameGeneratorTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "generate continues from the previous highest index" do
|
||||
account = Account.create!(external_account_id: "12th", name: "Newart's 12th Fizzy")
|
||||
Current.without_account do
|
||||
account = ::Account.create!(external_account_id: "12th", name: "Newart's 12th Fizzy")
|
||||
::Current.without_account do
|
||||
@identity.users.create!(account: account, name: @name)
|
||||
@identity.reload
|
||||
end
|
||||
|
||||
@@ -4,8 +4,8 @@ class SignupTest < ActiveSupport::TestCase
|
||||
test "#create_identity" do
|
||||
signup = Signup.new(email_address: "brian@example.com")
|
||||
|
||||
assert_difference -> { Identity.count }, 1 do
|
||||
assert_difference -> { MagicLink.count }, 1 do
|
||||
assert_difference -> { ::Identity.count }, 1 do
|
||||
assert_difference -> { ::MagicLink.count }, 1 do
|
||||
assert signup.create_identity
|
||||
end
|
||||
end
|
||||
@@ -16,8 +16,8 @@ class SignupTest < ActiveSupport::TestCase
|
||||
|
||||
signup_existing = Signup.new(email_address: "brian@example.com")
|
||||
|
||||
assert_no_difference -> { Identity.count } do
|
||||
assert_difference -> { MagicLink.count }, 1 do
|
||||
assert_no_difference -> { ::Identity.count } do
|
||||
assert_difference -> { ::MagicLink.count }, 1 do
|
||||
assert signup_existing.create_identity, "Should send magic link for existing identity"
|
||||
end
|
||||
end
|
||||
@@ -29,8 +29,8 @@ class SignupTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "#complete" do
|
||||
Account.any_instance.expects(:setup_customer_template).once
|
||||
Current.without_account do
|
||||
::Account.any_instance.expects(:setup_customer_template).once
|
||||
::Current.without_account do
|
||||
signup = Signup.new(
|
||||
full_name: "Kevin",
|
||||
identity: identities(:kevin)
|
||||
|
||||
Reference in New Issue
Block a user