3153: update tests to look for new user created message also when an inactive user...
authorradhika <radhika@curoverse.com>
Sat, 23 Aug 2014 19:17:15 +0000 (15:17 -0400)
committerradhika <radhika@curoverse.com>
Sat, 23 Aug 2014 19:17:15 +0000 (15:17 -0400)
services/api/app/mailers/admin_notifier.rb
services/api/test/unit/user_test.rb

index d86a2814abdeed9007ed7c9d52fbbbba03e9be7b..36798bebe94a2f50e4bc2d142e17f5446f152b16 100644 (file)
@@ -12,11 +12,11 @@ class AdminNotifier < ActionMailer::Base
 
       add_to_subject = ''
       if Rails.configuration.auto_setup_new_users
-        add_to_subject = @user.is_invited ? 'and setup ' : ', but not setup '
+        add_to_subject = @user.is_invited ? ' and setup' : ', but not setup'
       end
 
       mail(to: @recipients,
-           subject: "#{Rails.configuration.email_subject_prefix}New user created #{add_to_subject}notification"
+           subject: "#{Rails.configuration.email_subject_prefix}New user created#{add_to_subject} notification"
           )
     end
   end
index d93d8ae0c887c05fb19a7f23121dd253aa0492c1..dd8afd5ea6e506b479162f10298ba7cab76769f8 100644 (file)
@@ -547,6 +547,14 @@ class UserTest < ActiveSupport::TestCase
       else
         assert_nil new_inactive_user_email, 'Did not expect new inactive user email after setup'
       end
+      if not active_recipients.empty? then
+        assert_not_nil new_user_email, 'Expected new user email after setup'
+        assert_equal Rails.configuration.user_notifier_email_from, new_user_email.from[0]
+        assert_equal active_recipients, new_user_email.to[0]
+        assert_equal new_user_email_subject, new_user_email.subject
+      else
+        assert_nil new_user_email, 'Did not expect new user email after setup'
+      end
     end
 
     if active