Defect #37166 » fix-37166.patch
app/models/member_role.rb | ||
---|---|---|
52 | 52 |
private |
53 | 53 | |
54 | 54 |
def remove_member_if_empty |
55 |
if @member_removal != false && member.roles.empty? |
|
55 |
if @member_removal != false && member.roles.reload.empty?
|
|
56 | 56 |
member.destroy |
57 | 57 |
end |
58 | 58 |
end |
test/unit/member_test.rb | ||
---|---|---|
225 | 225 |
) |
226 | 226 |
end |
227 | 227 |
end |
228 | ||
229 |
def test_destroy_member_when_member_role_is_empty |
|
230 |
member = Member.find(1) |
|
231 | ||
232 |
assert_difference 'Member.count', -1 do |
|
233 |
member.role_ids = [] # Destroy roles associated with member |
|
234 |
end |
|
235 |
assert member.destroyed? |
|
236 |
assert_raise(ActiveRecord::RecordNotFound) { Member.find(1) } |
|
237 |
end |
|
228 | 238 |
end |
- « Previous
- 1
- 2
- Next »