From cc96c60c4617c09379d5e1ddbefa42407329c19a Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 18 Jul 2013 12:12:07 +0200 Subject: testing all versions of emial identities, emails are now strings --- users/test/unit/identity_test.rb | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'users/test/unit') diff --git a/users/test/unit/identity_test.rb b/users/test/unit/identity_test.rb index 3130ddc..a5d30b0 100644 --- a/users/test/unit/identity_test.rb +++ b/users/test/unit/identity_test.rb @@ -6,7 +6,11 @@ class IdentityTest < ActiveSupport::TestCase @user = FactoryGirl.create(:user) end - test "user has identity to start with" do + teardown do + @user.destroy + end + + test "initial identity for a user" do id = @user.build_identity assert_equal @user.email_address, id.address assert_equal @user.email_address, id.destination @@ -14,18 +18,32 @@ class IdentityTest < ActiveSupport::TestCase end test "add alias" do - skip - @user.create_identity address: @alias + id = @user.build_identity address: alias_name + assert_equal LocalEmail.new(alias_name), id.address + assert_equal @user.email_address, id.destination + assert_equal @user, id.user end test "add forward" do - skip - @user.create_identity destination: @external + id = @user.build_identity destination: forward_address + assert_equal @user.email_address, id.address + assert_equal Email.new(forward_address), id.destination + assert_equal @user, id.user end test "forward alias" do - skip - @user.create_identity address: @alias, destination: @external + id = @user.build_identity address: alias_name, destination: forward_address + assert_equal LocalEmail.new(alias_name), id.address + assert_equal Email.new(forward_address), id.destination + assert_equal @user, id.user + id.save end + def alias_name + @alias_name ||= Faker::Internet.user_name + end + + def forward_address + @forward_address ||= Faker::Internet.email + end end -- cgit v1.2.3