Commit 953a006f96f3c84d481a81ab6d50a103f9811687

Authored by Fabio Teixeira
Committed by Luciano Prestes
1 parent cbdd6f88

deactive_and_active_profile: Update tests for deactivate and activate profile

(ActionItem3287)

Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
test/functional/profile_editor_controller_test.rb
... ... @@ -1099,6 +1099,8 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
1099 1099 login_as('user')
1100 1100  
1101 1101 community = fast_create(Community)
  1102 + assert_equal true, community.enable
  1103 +
1102 1104 get :index, :profile => community.identifier
1103 1105 get :deactivate_profile, {:profile => community.identifier, :id => community.id}
1104 1106 assert_equal @request.session[:notice], "The profile '#{community.name}' was disabled."
... ... @@ -1111,6 +1113,8 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
1111 1113 login_as('user')
1112 1114  
1113 1115 community = fast_create(Community)
  1116 + assert_equal true, community.disable
  1117 +
1114 1118 get :index, :profile => community.identifier
1115 1119 get :activate_profile, {:profile => community.identifier, :id => community.id}
1116 1120 assert_equal @request.session[:notice], "The profile '#{community.name}' was activated."
... ...
test/unit/profile_test.rb
... ... @@ -1959,9 +1959,18 @@ class ProfileTest &lt; ActiveSupport::TestCase
1959 1959 should 'enable profile visibility' do
1960 1960 profile = fast_create(Profile)
1961 1961  
1962   - assert profile.enable, _("Profile should have been enabled")
1963   - assert profile.visible, _("Profile should be visible")
1964   - profile.disable
1965   - assert !profile.visible, _("Profile should not be visible")
  1962 + assert_equal true, profile.disable
  1963 +
  1964 + assert_equal true, profile.enable
  1965 + assert_equal true, profile.visible?
  1966 + end
  1967 +
  1968 + should 'disable profile visibility' do
  1969 + profile = fast_create(Profile)
  1970 +
  1971 + assert_equal true, profile.enable
  1972 +
  1973 + assert_equal true, profile.disable
  1974 + assert_equal false, profile.visible?
1966 1975 end
1967 1976 end
... ...
test/unit/user_mailer_test.rb
... ... @@ -21,14 +21,14 @@ class UserMailerTest &lt; ActiveSupport::TestCase
21 21 should 'deliver deactivation email' do
22 22 assert_difference 'ActionMailer::Base.deliveries.size' do
23 23 u = create_user('some-user')
24   - UserMailer.ban_user_mail_with_reason(u,"reason").deliver
  24 + UserMailer.ban_user_mail_with_reason(u,"reason", Profile.find(u.id)).deliver
25 25 end
26 26 end
27 27  
28 28 should 'verify deactivation email' do
29 29 u = create_user('some-user')
30   - email = UserMailer.ban_user_mail_with_reason(u,"you lose").deliver
31   - assert_match("[#{u.environment}] User deactivated", email.subject)
  30 + email = UserMailer.ban_user_mail_with_reason(u,"you lose", Profile.find(u.id)).deliver
  31 + assert_match("[#{u.environment}] Profile deactivated", email.subject)
32 32 end
33 33  
34 34 private
... ...