Patch by Mizuki ISHIKAWA.
git-svn-id: https://svn.redmine.org/redmine/trunk@22182
e93f8b46-1217-0410-a6f0-
8f06a7374b81
private
def remove_member_if_empty
- if @member_removal != false && member.roles.empty?
+ if @member_removal != false && member.roles.reload.empty?
member.destroy
end
end
)
end
end
+
+ def test_destroy_member_when_member_role_is_empty
+ member = Member.find(1)
+
+ assert_difference 'Member.count', -1 do
+ member.role_ids = [] # Destroy roles associated with member
+ end
+ assert member.destroyed?
+ assert_raise(ActiveRecord::RecordNotFound) { Member.find(1) }
+ end
end