summaryrefslogtreecommitdiff
path: root/test/unit/identity_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/identity_test.rb')
-rw-r--r--test/unit/identity_test.rb29
1 files changed, 17 insertions, 12 deletions
diff --git a/test/unit/identity_test.rb b/test/unit/identity_test.rb
index 1f93109..9d4bc90 100644
--- a/test/unit/identity_test.rb
+++ b/test/unit/identity_test.rb
@@ -110,33 +110,38 @@ class IdentityTest < ActiveSupport::TestCase
assert @id.errors.messages[:destination].include? "needs to be a valid email address"
end
- test "disabled identity" do
+ test "disable identity" do
@id = Identity.for(@user)
- @id.disable
+ @id.disable!
+ assert !@id.enabled?
+ assert @id.valid?
+ end
+
+ test "orphan identity" do
+ @id = Identity.for(@user)
+ @id.orphan!
assert_equal @user.email_address, @id.address
assert_equal nil, @id.destination
assert_equal nil, @id.user
- assert !@id.enabled?
+ assert @id.orphaned?
assert @id.valid?
end
- test "disabled identity blocks handle" do
+ test "orphaned identity blocks handle" do
@id = Identity.for(@user)
- @id.disable
- @id.save
+ @id.orphan!
other_user = find_record :user
taken = Identity.build_for other_user, address: @id.address
assert !taken.valid?
assert_equal ["has already been taken"], taken.errors[:address]
end
- test "destroy all disabled identities" do
+ test "destroy all orphaned identities" do
@id = Identity.for(@user)
- @id.disable
- @id.save
- assert Identity.disabled.count > 0
- Identity.destroy_all_disabled
- assert_equal 0, Identity.disabled.count
+ @id.orphan!
+ assert Identity.orphaned.count > 0
+ Identity.destroy_all_orphaned
+ assert_equal 0, Identity.orphaned.count
end
test "store cert fingerprint" do