Files
fizzy/test/models/identity_test.rb
T
Mike Dalessio e3d86bb21e Clean up some spots where "current account" is ambiguous
Primarily this is in tests (which were caught by temporarily
introducing acts_as_tenant and enabling safety checks), but notably
action cable connections were not working properly, and that's now
fixed.
2025-11-17 09:12:41 -05:00

39 lines
959 B
Ruby

require "test_helper"
class IdentityTest < ActiveSupport::TestCase
include ActionMailer::TestHelper
test "send_magic_link" do
identity = identities(:david)
assert_emails 1 do
magic_link = identity.send_magic_link
assert_not_nil magic_link
assert_equal identity, magic_link.identity
end
end
test "staff?" do
assert Identity.new(email_address: "test@37signals.com").staff?
assert Identity.new(email_address: "test@basecamp.com").staff?
assert_not Identity.new(email_address: "test@example.com").staff?
end
test "join" do
identity = identities(:david)
account = accounts(:initech)
Current.without_account do
assert_difference "User.count", 1 do
identity.join(account)
end
user = account.users.find_by!(identity: identity)
assert_not_nil user
assert_equal identity, user.identity
assert_equal identity.email_address, user.name
end
end
end