Files
fizzy/test/models/identity_test.rb
T
Stanko K.R. f64a49dcc0 Determine staff members based on flag
This replaces the old system based on email addresses, the aim is to make it more generic and thus appropriate for OSS/self-hosting

See: https://3.basecamp.com/2914079/buckets/37331921/todos/9302705265#__recording_9320051455
2025-11-25 14:09:31 +01:00

33 lines
728 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 "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