verify_link_existence response_user['uuid'], response_user['email'],
false, false, false, false, false
+
+ assert_equal([], User.find_by_uuid(users(:active).uuid).groups_i_can(:read),
+ "active user can still read some groups after being deactivated")
end
test "setup user with send notification param false and verify no email" do
check_active_users_index
end
- test "update inactive user profile and expect notification email" do
+ test "update active_no_prefs user profile and expect notification email" do
authorize_with :admin
put :update, {
- id: users(:inactive).uuid,
+ id: users(:active_no_prefs).uuid,
user: {
- prefs: {:profile => {'organization' => 'Curoverse'}}
+ prefs: {:profile => {'organization' => 'example.com'}}
}
}
assert_response :success
found_email = false
ActionMailer::Base.deliveries.andand.each do |email|
- if email.subject == "Profile created by #{users(:inactive).email}"
+ if email.subject == "Profile created by #{users(:active_no_prefs).email}"
+ found_email = true
+ break
+ end
+ end
+ assert_equal true, found_email, 'Expected email after creating profile'
+ end
+
+ test "update active_no_prefs_profile user profile and expect notification email" do
+ authorize_with :admin
+
+ user = {}
+ user[:prefs] = users(:active_no_prefs_profile).prefs
+ user[:prefs][:profile] = {:profile => {'organization' => 'example.com'}}
+ put :update, {
+ id: users(:active_no_prefs_profile).uuid,
+ user: user
+ }
+ assert_response :success
+
+ found_email = false
+ ActionMailer::Base.deliveries.andand.each do |email|
+ if email.subject == "Profile created by #{users(:active_no_prefs_profile).email}"
found_email = true
break
end
put :update, {
id: users(:active).uuid,
user: {
- prefs: {:profile => {'organization' => 'Curoverse'}}
+ prefs: {:profile => {'organization' => 'anotherexample.com'}}
}
}
assert_response :success