Rails4: replace deprecated find_all_by_* at UserTest
git-svn-id: http://svn.redmine.org/redmine/trunk@12571 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
b3dbe07c95
commit
907663f83c
|
@ -183,18 +183,18 @@ class UserTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy_should_delete_members_and_roles
|
def test_destroy_should_delete_members_and_roles
|
||||||
members = Member.find_all_by_user_id(2)
|
members = Member.where(:user_id => 2)
|
||||||
ms = members.size
|
ms = members.count
|
||||||
rs = members.collect(&:roles).flatten.size
|
rs = members.collect(&:roles).flatten.size
|
||||||
|
assert ms > 0
|
||||||
|
assert rs > 0
|
||||||
assert_difference 'Member.count', - ms do
|
assert_difference 'Member.count', - ms do
|
||||||
assert_difference 'MemberRole.count', - rs do
|
assert_difference 'MemberRole.count', - rs do
|
||||||
User.find(2).destroy
|
User.find(2).destroy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_nil User.find_by_id(2)
|
assert_nil User.find_by_id(2)
|
||||||
assert Member.find_all_by_user_id(2).empty?
|
assert_equal 0, Member.where(:user_id => 2).count
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy_should_update_attachments
|
def test_destroy_should_update_attachments
|
||||||
|
|
Loading…
Reference in New Issue