Commit 771ecf6956e462a468e53e2cb0fd56954ca0c77c
1 parent
0b4205ce
Exists in
master
and in
22 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 | 24 | |
| 25 | 25 | should 'create tracked action' do |
| 26 | 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 | 31 | ta = ActionTracker::Record.last |
| 29 | 32 | assert_equal a, ta.user |
| 30 | 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 | 38 | ta = ActionTracker::Record.last |
| 33 | 39 | assert_equal a, ta.user |
| 34 | 40 | assert_equal 'c', ta.get_friend_name[1] |
| ... | ... | @@ -36,11 +42,17 @@ class FriendshipTest < ActiveSupport::TestCase |
| 36 | 42 | |
| 37 | 43 | should 'create tracked action for both people' do |
| 38 | 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 | 49 | ta = ActionTracker::Record.last |
| 41 | 50 | assert_equal a, ta.user |
| 42 | 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 | 56 | ta = ActionTracker::Record.last |
| 45 | 57 | assert_equal b, ta.user |
| 46 | 58 | assert_equal ['a'], ta.get_friend_name | ... | ... |