Commit 771ecf6956e462a468e53e2cb0fd56954ca0c77c
1 parent
0b4205ce
Exists in
master
and in
29 other branches
rails3: fix Friendship unit tests
Showing
1 changed file
with
16 additions
and
4 deletions
Show diff stats
test/unit/friendship_test.rb
@@ -24,11 +24,17 @@ class FriendshipTest < ActiveSupport::TestCase | @@ -24,11 +24,17 @@ class FriendshipTest < ActiveSupport::TestCase | ||
24 | 24 | ||
25 | should 'create tracked action' do | 25 | should 'create tracked action' do |
26 | a, b, c = create_user('a').person, create_user('b').person, create_user('c').person | 26 | a, b, c = create_user('a').person, create_user('b').person, create_user('c').person |
27 | - f = Friendship.create! :person => a, :friend => b | 27 | + f = Friendship.new |
28 | + f.person = a | ||
29 | + f.friend = b | ||
30 | + f.save! | ||
28 | ta = ActionTracker::Record.last | 31 | ta = ActionTracker::Record.last |
29 | assert_equal a, ta.user | 32 | assert_equal a, ta.user |
30 | assert_equal 'b', ta.get_friend_name[0] | 33 | assert_equal 'b', ta.get_friend_name[0] |
31 | - f = Friendship.create! :person => a, :friend => c | 34 | + f = Friendship.new |
35 | + f.person = a | ||
36 | + f.friend = c | ||
37 | + f.save! | ||
32 | ta = ActionTracker::Record.last | 38 | ta = ActionTracker::Record.last |
33 | assert_equal a, ta.user | 39 | assert_equal a, ta.user |
34 | assert_equal 'c', ta.get_friend_name[1] | 40 | assert_equal 'c', ta.get_friend_name[1] |
@@ -36,11 +42,17 @@ class FriendshipTest < ActiveSupport::TestCase | @@ -36,11 +42,17 @@ class FriendshipTest < ActiveSupport::TestCase | ||
36 | 42 | ||
37 | should 'create tracked action for both people' do | 43 | should 'create tracked action for both people' do |
38 | a, b = create_user('a').person, create_user('b').person | 44 | a, b = create_user('a').person, create_user('b').person |
39 | - f = Friendship.create! :person => a, :friend => b | 45 | + f = Friendship.new |
46 | + f.person = a | ||
47 | + f.friend = b | ||
48 | + f.save! | ||
40 | ta = ActionTracker::Record.last | 49 | ta = ActionTracker::Record.last |
41 | assert_equal a, ta.user | 50 | assert_equal a, ta.user |
42 | assert_equal ['b'], ta.get_friend_name | 51 | assert_equal ['b'], ta.get_friend_name |
43 | - f = Friendship.create! :person => b, :friend => a | 52 | + f = Friendship.new |
53 | + f.person = b | ||
54 | + f.friend = a | ||
55 | + f.save! | ||
44 | ta = ActionTracker::Record.last | 56 | ta = ActionTracker::Record.last |
45 | assert_equal b, ta.user | 57 | assert_equal b, ta.user |
46 | assert_equal ['a'], ta.get_friend_name | 58 | assert_equal ['a'], ta.get_friend_name |