Commit 2937a8f311a362b1bb76f91be94d49c27ab5530d
1 parent
a0c06c26
Fixes ExternalPerson and Friendships unit tests
Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com>
Showing
4 changed files
with
7 additions
and
16 deletions
Show diff stats
app/models/friendship.rb
@@ -10,9 +10,6 @@ class Friendship < ApplicationRecord | @@ -10,9 +10,6 @@ class Friendship < ApplicationRecord | ||
10 | Friendship.update_cache_counter(:friends_count, friendship.person, 1) | 10 | Friendship.update_cache_counter(:friends_count, friendship.person, 1) |
11 | Friendship.update_cache_counter(:friends_count, friendship.friend, 1) | 11 | Friendship.update_cache_counter(:friends_count, friendship.friend, 1) |
12 | 12 | ||
13 | - p "*"*60 | ||
14 | - p "BEFORE CIRCLES" | ||
15 | - p "*"*60 | ||
16 | circles = friendship.group.blank? ? ['friendships'] : friendship.group.split(',').map(&:strip) | 13 | circles = friendship.group.blank? ? ['friendships'] : friendship.group.split(',').map(&:strip) |
17 | circles.each do |circle| | 14 | circles.each do |circle| |
18 | friendship.person.follow(friendship.friend, Circle.find_or_create_by(:person => friendship.person, :name => circle, :profile_type => 'Person')) | 15 | friendship.person.follow(friendship.friend, Circle.find_or_create_by(:person => friendship.person, :name => circle, :profile_type => 'Person')) |
test/unit/friendship_test.rb
@@ -81,8 +81,8 @@ class FriendshipTest < ActiveSupport::TestCase | @@ -81,8 +81,8 @@ class FriendshipTest < ActiveSupport::TestCase | ||
81 | p2.add_friend(p1, 'friends') | 81 | p2.add_friend(p1, 'friends') |
82 | end | 82 | end |
83 | 83 | ||
84 | - assert_includes p1.followers(true), p2 | ||
85 | - assert_includes p2.followers(true), p1 | 84 | + assert_includes p1.followers, p2 |
85 | + assert_includes p2.followers, p1 | ||
86 | end | 86 | end |
87 | 87 | ||
88 | should 'remove follower when a friend removal occurs' do | 88 | should 'remove follower when a friend removal occurs' do |
@@ -94,8 +94,8 @@ class FriendshipTest < ActiveSupport::TestCase | @@ -94,8 +94,8 @@ class FriendshipTest < ActiveSupport::TestCase | ||
94 | 94 | ||
95 | Friendship.remove_friendship(p1, p2) | 95 | Friendship.remove_friendship(p1, p2) |
96 | 96 | ||
97 | - assert_not_includes p1.followers(true), p2 | ||
98 | - assert_not_includes p2.followers(true), p1 | 97 | + assert_not_includes p1.followers, p2 |
98 | + assert_not_includes p2.followers, p1 | ||
99 | end | 99 | end |
100 | 100 | ||
101 | should 'keep friendship intact when stop following' do | 101 | should 'keep friendship intact when stop following' do |
test/unit/profile_followers_test.rb
@@ -11,8 +11,8 @@ class ProfileFollowersTest < ActiveSupport::TestCase | @@ -11,8 +11,8 @@ class ProfileFollowersTest < ActiveSupport::TestCase | ||
11 | p1.follow(p2, circle) | 11 | p1.follow(p2, circle) |
12 | end | 12 | end |
13 | 13 | ||
14 | - assert_includes p2.followers(true), p1 | ||
15 | - assert_not_includes p1.followers(true), p2 | 14 | + assert_includes p2.followers, p1 |
15 | + assert_not_includes p1.followers, p2 | ||
16 | end | 16 | end |
17 | 17 | ||
18 | should 'a person unfollow another person' do | 18 | should 'a person unfollow another person' do |
@@ -26,7 +26,7 @@ class ProfileFollowersTest < ActiveSupport::TestCase | @@ -26,7 +26,7 @@ class ProfileFollowersTest < ActiveSupport::TestCase | ||
26 | p1.unfollow(p2) | 26 | p1.unfollow(p2) |
27 | end | 27 | end |
28 | 28 | ||
29 | - assert_not_includes p2.followers(true), p1 | 29 | + assert_not_includes p2.followers, p1 |
30 | end | 30 | end |
31 | 31 | ||
32 | should 'get the followed persons for a profile' do | 32 | should 'get the followed persons for a profile' do |
vendor/plugins/action_tracker/lib/action_tracker.rb
@@ -95,9 +95,6 @@ module ActionTracker | @@ -95,9 +95,6 @@ module ActionTracker | ||
95 | return nil if user.nil? | 95 | return nil if user.nil? |
96 | if keep_params.is_a? Array | 96 | if keep_params.is_a? Array |
97 | stored_params = {} | 97 | stored_params = {} |
98 | - p "&"*40 | ||
99 | - p "keep_params: #{keep_params}" | ||
100 | - p "&"*40 | ||
101 | keep_params.each do |param| | 98 | keep_params.each do |param| |
102 | result = self | 99 | result = self |
103 | param.to_s.split('.').each { |m| result = result.send(m) } | 100 | param.to_s.split('.').each { |m| result = result.send(m) } |
@@ -117,9 +114,6 @@ module ActionTracker | @@ -117,9 +114,6 @@ module ActionTracker | ||
117 | Record.new :verb => verb, :params => stored_params, :user => user | 114 | Record.new :verb => verb, :params => stored_params, :user => user |
118 | end | 115 | end |
119 | tracked_action.target = target || self | 116 | tracked_action.target = target || self |
120 | - p "*"*40 | ||
121 | - p "user: #{user}" | ||
122 | - p "*"*40 | ||
123 | user.tracked_actions << tracked_action | 117 | user.tracked_actions << tracked_action |
124 | post_proc.call tracked_action | 118 | post_proc.call tracked_action |
125 | end | 119 | end |