From 49d3e9df74685fe17a2abbbabdd17014f2371065 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 10 Feb 2016 10:56:57 -0800 Subject: allow user accounts to be re-enabled, and for associated identities to also get re-enabled. --- test/unit/identity_test.rb | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'test/unit/identity_test.rb') 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 -- cgit v1.2.3