Commit 8548bd8a82b1356435f76c34560a5e8a3c6d3aa1

Authored by Braulio Bhavamitra
1 parent b9d2cc07

rails4: fix units and plugins tests

app/helpers/application_helper.rb
@@ -8,6 +8,8 @@ module ApplicationHelper @@ -8,6 +8,8 @@ module ApplicationHelper
8 8
9 include PermissionNameHelper 9 include PermissionNameHelper
10 10
  11 + include UrlHelper
  12 +
11 include ModalHelper 13 include ModalHelper
12 14
13 include BoxesHelper 15 include BoxesHelper
app/helpers/url_helper.rb 0 → 100644
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
  1 +module UrlHelper
  2 +
  3 + def back_url
  4 + 'javascript:history.back()'
  5 + end
  6 +
  7 +end
app/models/article.rb
@@ -789,7 +789,7 @@ class Article < ActiveRecord::Base @@ -789,7 +789,7 @@ class Article < ActiveRecord::Base
789 end 789 end
790 790
791 def activity 791 def activity
792 - ActionTracker::Record.find_by_target_type_and_target_id 'Article', self.id 792 + ActionTracker::Record.where(target_type: 'Article', target_id: self.id).first
793 end 793 end
794 794
795 def create_activity 795 def create_activity
app/models/environment.rb
@@ -960,7 +960,7 @@ class Environment < ActiveRecord::Base @@ -960,7 +960,7 @@ class Environment < ActiveRecord::Base
960 end 960 end
961 961
962 def highlighted_products_with_image(options = {}) 962 def highlighted_products_with_image(options = {})
963 - self.products.where(highlighted: true).joins(:image) 963 + self.products.where(highlighted: true).joins(:image).order('created_at ASC')
964 end 964 end
965 965
966 settings_items :home_cache_in_minutes, :type => :integer, :default => 5 966 settings_items :home_cache_in_minutes, :type => :integer, :default => 5
app/models/event.rb
@@ -36,7 +36,7 @@ class Event < Article @@ -36,7 +36,7 @@ class Event < Article
36 36
37 scope :by_day, -> (date) { 37 scope :by_day, -> (date) {
38 where('start_date >= :start_date AND start_date <= :end_date AND end_date IS NULL OR (start_date <= :end_date AND end_date >= :start_date)', 38 where('start_date >= :start_date AND start_date <= :end_date AND end_date IS NULL OR (start_date <= :end_date AND end_date >= :start_date)',
39 - {:start_date => date.beginning_of_day, :end_date => date.end_of_day}). 39 + start_date: date.beginning_of_day, end_date: date.end_of_day).
40 order('start_date ASC') 40 order('start_date ASC')
41 } 41 }
42 42
plugins/driven_signup/Gemfile 0 → 100644
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
  1 +gem 'slim'
  2 +
plugins/driven_signup/controllers/public/driven_signup_plugin/account_controller.rb
@@ -25,9 +25,11 @@ class DrivenSignupPlugin::AccountController &lt; PublicController @@ -25,9 +25,11 @@ class DrivenSignupPlugin::AccountController &lt; PublicController
25 25
26 protected 26 protected
27 27
28 - def default_url_options  
29 - # avoid rails' use_relative_controller!  
30 - {use_route: '/'} 28 + # inherit routes from core skipping use_relative_controller!
  29 + def url_for options
  30 + options[:controller] = "/#{options[:controller]}" if options.is_a? Hash
  31 + super options
31 end 32 end
  33 + helper_method :url_for
32 34
33 end 35 end
plugins/driven_signup/test/functional/account_controller_test.rb
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -require 'test_helper'  
2 -  
3 -# Re-raise errors caught by the controller.  
4 -class AccountController; def rescue_action(e) raise e end; end  
5 -  
6 -class AccountControllerTest < ActionController::TestCase  
7 -  
8 - def setup  
9 - @controller = AccountController.new  
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new  
12 -  
13 - e = Environment.default  
14 - e.enable 'skip_new_user_email_confirmation', true  
15 - disable_signup_bot_check e  
16 - end  
17 -  
18 - should 'use the parameters' do  
19 - community = create Community, name: 'base', identifier: 'base1'  
20 - subcommunity = create Community, name: 'sub', identifier: 'base11'  
21 - subcommunity.reload  
22 -  
23 - # simulate DrivenSignupPlugin::AccountController  
24 - session[:driven_signup] = true  
25 - session[:base_organization] = community.identifier  
26 - session[:find_suborganization] = true  
27 - session[:suborganization_members_limit] = 50  
28 -  
29 - post :signup, user: {login: 'quire', password: 'quire', password_confirmation: 'quire', name: 'quire', email: 'test@example.com'}  
30 - assert_response :redirect  
31 - assert_redirected_to subcommunity.url  
32 -  
33 - user = Profile['quire']  
34 - assert user  
35 - assert_includes subcommunity.members, user  
36 - end  
37 -  
38 - private  
39 -  
40 - def disable_signup_bot_check environment = Environment.default  
41 - environment.min_signup_delay = 0  
42 - environment.save!  
43 - end  
44 -  
45 -end  
plugins/driven_signup/test/integration/account_controller_test.rb 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  1 +require 'test_helper'
  2 +
  3 +# Re-raise errors caught by the controller.
  4 +class AccountController; def rescue_action(e) raise e end; end
  5 +
  6 +class AccountControllerTest < ActionDispatch::IntegrationTest
  7 +
  8 + def setup
  9 + @controller = AccountController.new
  10 + @request = ActionController::TestRequest.new
  11 + @response = ActionController::TestResponse.new
  12 +
  13 + e = Environment.default
  14 + e.enable 'skip_new_user_email_confirmation', true
  15 + disable_signup_bot_check e
  16 + end
  17 +
  18 + should 'use the parameters' do
  19 + token = '131324'
  20 + Environment.default.driven_signup_auths.create! token: token
  21 + community = create Community, name: 'base', identifier: 'base1'
  22 + subcommunity = create Community, name: 'sub', identifier: 'base11'
  23 + subcommunity.reload
  24 +
  25 + # simulate DrivenSignupPlugin::AccountController
  26 + session[:driven_signup] = true
  27 + session[:base_organization] = community.identifier
  28 + session[:find_suborganization] = true
  29 + session[:suborganization_members_limit] = 50
  30 +
  31 + post url_for(controller: 'driven_signup_plugin/account', action: :signup, token: token, signup: {login: 'quire', name: 'quire', email: 'test@example.com'})
  32 + assert_response :redirect
  33 + assert_redirected_to url_for(controller: '/account', action: :signup, user: {login: 'quire', email: 'test@example.com',},
  34 + profile_data: {name: 'quire'})
  35 + end
  36 +
  37 + private
  38 +
  39 + def disable_signup_bot_check environment = Environment.default
  40 + environment.min_signup_delay = 0
  41 + environment.save!
  42 + end
  43 +
  44 +end
plugins/fb_app/controllers/public/fb_app_plugin_page_tab_controller.rb
@@ -88,7 +88,7 @@ class FbAppPluginPageTabController &lt; FbAppPluginController @@ -88,7 +88,7 @@ class FbAppPluginPageTabController &lt; FbAppPluginController
88 end 88 end
89 89
90 def enterprise_search 90 def enterprise_search
91 - scope = environment.enterprises.enabled.public 91 + scope = environment.enterprises.enabled.is_public
92 @query = params[:query] 92 @query = params[:query]
93 @profiles = scope.limit(10).order('name ASC'). 93 @profiles = scope.limit(10).order('name ASC').
94 where(['name ILIKE ? OR name ILIKE ? OR identifier LIKE ?', "#{@query}%", "% #{@query}%", "#{@query}%"]) 94 where(['name ILIKE ? OR name ILIKE ? OR identifier LIKE ?', "#{@query}%", "% #{@query}%", "#{@query}%"])
plugins/oauth_client/lib/ext/profile.rb
1 require_dependency 'profile' 1 require_dependency 'profile'
2 2
3 -class Profile 3 +Profile.descendants.each do |subclass|
  4 + subclass.class_eval do
4 5
5 - has_many :oauth_auths, class_name: 'OauthClientPlugin::Auth', dependent: :destroy  
6 - has_many :oauth_providers, through: :oauth_auths, source: :provider 6 + has_many :oauth_auths, foreign_key: :profile_id, class_name: 'OauthClientPlugin::Auth', dependent: :destroy
  7 + has_many :oauth_providers, through: :oauth_auths, source: :provider
7 8
  9 + end
8 end 10 end
plugins/open_graph/controllers/myprofile/open_graph_plugin/myprofile_controller.rb
@@ -4,11 +4,11 @@ class OpenGraphPlugin::MyprofileController &lt; MyProfileController @@ -4,11 +4,11 @@ class OpenGraphPlugin::MyprofileController &lt; MyProfileController
4 before_filter :set_context 4 before_filter :set_context
5 5
6 def enterprise_search 6 def enterprise_search
7 - scope = environment.enterprises.enabled.public 7 + scope = environment.enterprises.enabled.is_public
8 profile_search scope 8 profile_search scope
9 end 9 end
10 def community_search 10 def community_search
11 - scope = environment.communities.public 11 + scope = environment.communities.is_public
12 profile_search scope 12 profile_search scope
13 end 13 end
14 def friend_search 14 def friend_search
@@ -38,10 +38,13 @@ class OpenGraphPlugin::MyprofileController &lt; MyProfileController @@ -38,10 +38,13 @@ class OpenGraphPlugin::MyprofileController &lt; MyProfileController
38 OpenGraphPlugin.context = self.context 38 OpenGraphPlugin.context = self.context
39 end 39 end
40 40
41 - def default_url_options  
42 - # avoid rails' use_relative_controller!  
43 - {use_route: '/'} 41 + # inherit routes from core skipping use_relative_controller!
  42 + def url_for options
  43 + options[:controller] = "/#{options[:controller]}" if options.is_a? Hash
  44 + super options
44 end 45 end
  46 + helper_method :url_for
  47 +
45 48
46 end 49 end
47 50
plugins/open_graph/lib/ext/profile.rb
@@ -7,11 +7,21 @@ Profile.descendants.each do |subclass| @@ -7,11 +7,21 @@ Profile.descendants.each do |subclass|
7 subclass.class_eval do 7 subclass.class_eval do
8 attr_accessible :open_graph_settings 8 attr_accessible :open_graph_settings
9 9
  10 + has_many :open_graph_tracks, class_name: 'OpenGraphPlugin::Track', source: :tracker_id, foreign_key: :tracker_id
  11 +
  12 + has_many :open_graph_activities, class_name: 'OpenGraphPlugin::Activity', source: :tracker_id, foreign_key: :tracker_id
  13 +
  14 + has_many :open_graph_track_configs, class_name: 'OpenGraphPlugin::TrackConfig', source: :tracker_id, foreign_key: :tracker_id
  15 +
10 OpenGraphPlugin::TrackConfig::Types.each do |track, klass| 16 OpenGraphPlugin::TrackConfig::Types.each do |track, klass|
11 klass = "OpenGraphPlugin::#{klass}".constantize 17 klass = "OpenGraphPlugin::#{klass}".constantize
12 attributes = "#{klass.association}_attributes" 18 attributes = "#{klass.association}_attributes"
13 profile_ids = "open_graph_#{track}_profiles_ids" 19 profile_ids = "open_graph_#{track}_profiles_ids"
14 20
  21 + association = klass.association
  22 + has_many association, class_name: klass.name, foreign_key: :tracker_id
  23 + accepts_nested_attributes_for association, allow_destroy: true, reject_if: :open_graph_reject_empty_object_type
  24 +
15 attr_accessible attributes 25 attr_accessible attributes
16 attr_accessible profile_ids 26 attr_accessible profile_ids
17 end 27 end
@@ -27,19 +37,11 @@ class Profile @@ -27,19 +37,11 @@ class Profile
27 end 37 end
28 alias_method :open_graph_settings=, :open_graph_settings 38 alias_method :open_graph_settings=, :open_graph_settings
29 39
30 - has_many :open_graph_tracks, class_name: 'OpenGraphPlugin::Track', source: :tracker_id, foreign_key: :tracker_id  
31 -  
32 - has_many :open_graph_activities, class_name: 'OpenGraphPlugin::Activity', source: :tracker_id, foreign_key: :tracker_id  
33 -  
34 - has_many :open_graph_track_configs, class_name: 'OpenGraphPlugin::TrackConfig', source: :tracker_id, foreign_key: :tracker_id  
35 OpenGraphPlugin::TrackConfig::Types.each do |track, klass| 40 OpenGraphPlugin::TrackConfig::Types.each do |track, klass|
36 klass = "OpenGraphPlugin::#{klass}".constantize 41 klass = "OpenGraphPlugin::#{klass}".constantize
37 association = klass.association 42 association = klass.association
38 profile_ids = "open_graph_#{track}_profiles_ids" 43 profile_ids = "open_graph_#{track}_profiles_ids"
39 44
40 - has_many association, class_name: klass.name, foreign_key: :tracker_id  
41 - accepts_nested_attributes_for association, allow_destroy: true, reject_if: :open_graph_reject_empty_object_type  
42 -  
43 define_method "#{profile_ids}=" do |ids| 45 define_method "#{profile_ids}=" do |ids|
44 cids = self.send(association).order('created_at ASC').map(&:object_data_id) 46 cids = self.send(association).order('created_at ASC').map(&:object_data_id)
45 nids = if ids.is_a? Array then ids else ids.split ',' end 47 nids = if ids.is_a? Array then ids else ids.split ',' end
plugins/open_graph/lib/open_graph_plugin/settings.rb
@@ -6,7 +6,7 @@ class OpenGraphPlugin::Settings &lt; Noosfero::Plugin::Settings @@ -6,7 +6,7 @@ class OpenGraphPlugin::Settings &lt; Noosfero::Plugin::Settings
6 6
7 OpenGraphPlugin::TrackConfig::Types.each do |track, klass| 7 OpenGraphPlugin::TrackConfig::Types.each do |track, klass|
8 define_method "#{track}_track_enabled=" do |value| 8 define_method "#{track}_track_enabled=" do |value|
9 - super ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value) 9 + super ActiveRecord::Type::Boolean.new.send :cast_value, value
10 end 10 end
11 end 11 end
12 12
plugins/open_graph/models/open_graph_plugin/enterprise_track_config.rb
@@ -14,7 +14,7 @@ class OpenGraphPlugin::EnterpriseTrackConfig &lt; OpenGraphPlugin::TrackConfig @@ -14,7 +14,7 @@ class OpenGraphPlugin::EnterpriseTrackConfig &lt; OpenGraphPlugin::TrackConfig
14 end 14 end
15 15
16 def self.profile_track_objects profile 16 def self.profile_track_objects profile
17 - (profile.enterprises.public.enabled + profile.favorite_enterprises.public.enabled).uniq 17 + (profile.enterprises.is_public.enabled + profile.favorite_enterprises.is_public.enabled).uniq
18 end 18 end
19 19
20 end 20 end
plugins/open_graph/views/open_graph_plugin/myprofile/_track_enterprise.html.erb
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 <%= t('open_graph_plugin.views.track.config.enterprise.memberships') %> 13 <%= t('open_graph_plugin.views.track.config.enterprise.memberships') %>
14 </h1> 14 </h1>
15 <div class="open-graph-enterprises-list"> 15 <div class="open-graph-enterprises-list">
16 - <% user.enterprises.public.enabled.each do |enterprise| %> 16 + <% user.enterprises.is_public.enabled.each do |enterprise| %>
17 <%= profile_image_link enterprise, :portrait, :div %> 17 <%= profile_image_link enterprise, :portrait, :div %>
18 <% end %> 18 <% end %>
19 </div> 19 </div>
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 </h1> 26 </h1>
27 <% if user.favorite_enterprises.present? %> 27 <% if user.favorite_enterprises.present? %>
28 <div class="open-graph-enterprises-list"> 28 <div class="open-graph-enterprises-list">
29 - <% user.favorite_enterprises.public.enabled.each do |enterprise| %> 29 + <% user.favorite_enterprises.is_public.enabled.each do |enterprise| %>
30 <%= profile_image_link enterprise, :portrait, :div %> 30 <%= profile_image_link enterprise, :portrait, :div %>
31 <% end %> 31 <% end %>
32 </div> 32 </div>
plugins/responsive/test/unit/foo_plugin_test.rb
@@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
1 -require File.dirname(__FILE__) + '/../../../../test/test_helper'  
2 -  
3 -class FooPluginTest < ActiveSupport::TestCase  
4 - def test_foo  
5 - FooPlugin::Bar.create!  
6 - end  
7 - def test_monkey_patch  
8 - Profile.new.bar  
9 - end  
10 -end  
plugins/site_tour/test/functional/site_tour_plugin_admin_controller_test.rb
1 -require File.dirname(__FILE__) + '/../test_helper' 1 +require 'test_helper'
2 2
3 class SiteTourPluginAdminControllerTest < ActionController::TestCase 3 class SiteTourPluginAdminControllerTest < ActionController::TestCase
4 4
plugins/site_tour/test/functional/site_tour_plugin_public_controller_test.rb
1 -require File.dirname(__FILE__) + '/../test_helper' 1 +require 'test_helper'
2 2
3 class SiteTourPluginPublicControllerTest < ActionController::TestCase 3 class SiteTourPluginPublicControllerTest < ActionController::TestCase
4 4
plugins/site_tour/test/unit/site_tour_helper_test.rb
1 -require File.dirname(__FILE__) + '/../test_helper' 1 +require 'test_helper'
2 2
3 class SiteTourHelperTest < ActionView::TestCase 3 class SiteTourHelperTest < ActionView::TestCase
4 4
plugins/site_tour/test/unit/site_tour_plugin_test.rb
1 -require File.dirname(__FILE__) + '/../test_helper' 1 +require 'test_helper'
2 2
3 class SiteTourPluginTest < ActionView::TestCase 3 class SiteTourPluginTest < ActionView::TestCase
4 4
plugins/site_tour/test/unit/tour_block_test.rb
1 -require File.dirname(__FILE__) + '/../test_helper' 1 +require 'test_helper'
2 2
3 class TrackListBlockTest < ActionView::TestCase 3 class TrackListBlockTest < ActionView::TestCase
4 4
plugins/stoa/config.yml 0 → 100644
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +salt: '123456789'
test/functional/search_controller_test.rb
@@ -316,7 +316,7 @@ class SearchControllerTest &lt; ActionController::TestCase @@ -316,7 +316,7 @@ class SearchControllerTest &lt; ActionController::TestCase
316 ev1 = create_event(person, :name => 'event 1', :category_ids => [@category.id], :start_date => ten_days_ago) 316 ev1 = create_event(person, :name => 'event 1', :category_ids => [@category.id], :start_date => ten_days_ago)
317 ev2 = create_event(person, :name => 'event 2', :category_ids => [@category.id], :start_date => DateTime.now - 2.month) 317 ev2 = create_event(person, :name => 'event 2', :category_ids => [@category.id], :start_date => DateTime.now - 2.month)
318 318
319 - get :events, :day => ten_days_ago.day, :month => ten_days_ago.month, :year => ten_days_ago.year 319 + get :events, day: ten_days_ago.day+1.second, month: ten_days_ago.month, year: ten_days_ago.year
320 assert_equal [ev1], assigns(:events) 320 assert_equal [ev1], assigns(:events)
321 end 321 end
322 322
@@ -326,10 +326,10 @@ class SearchControllerTest &lt; ActionController::TestCase @@ -326,10 +326,10 @@ class SearchControllerTest &lt; ActionController::TestCase
326 326
327 ev1 = create_event(person, :name => 'event 1', :start_date => ten_days_ago) 327 ev1 = create_event(person, :name => 'event 1', :start_date => ten_days_ago)
328 ev1.categories = [@category] 328 ev1.categories = [@category]
329 - 329 +
330 ev2 = create_event(person, :name => 'event 2', :start_date => ten_days_ago) 330 ev2 = create_event(person, :name => 'event 2', :start_date => ten_days_ago)
331 331
332 - get :events, :day => ten_days_ago.day, :month => ten_days_ago.month, :year => ten_days_ago.year, :category_path => @category.path.split('/') 332 + get :events, day: ten_days_ago.day+1.second, month: ten_days_ago.month, year: ten_days_ago.year, category_path: @category.path.split('/')
333 333
334 assert_equal [ev1], assigns(:events) 334 assert_equal [ev1], assigns(:events)
335 end 335 end
test/unit/article_test.rb
@@ -1089,12 +1089,13 @@ class ArticleTest &lt; ActiveSupport::TestCase @@ -1089,12 +1089,13 @@ class ArticleTest &lt; ActiveSupport::TestCase
1089 ActionTracker::Record.destroy_all 1089 ActionTracker::Record.destroy_all
1090 1090
1091 community = fast_create(Community) 1091 community = fast_create(Community)
1092 - member_1 = create_user.person 1092 + User.current = create_user
  1093 + member_1 = User.current.person
1093 community.add_member(member_1) 1094 community.add_member(member_1)
1094 1095
1095 article = create TinyMceArticle, :name => 'Tracked Article 1', :profile_id => community.id 1096 article = create TinyMceArticle, :name => 'Tracked Article 1', :profile_id => community.id
1096 first_activity = article.activity 1097 first_activity = article.activity
1097 - assert_equal [first_activity], ActionTracker::Record.find_all_by_verb('create_article') 1098 + assert_equal [first_activity], ActionTracker::Record.where(verb: 'create_article')
1098 1099
1099 process_delayed_job_queue 1100 process_delayed_job_queue
1100 assert_equal 2, ActionTrackerNotification.find_all_by_action_tracker_id(first_activity.id).count 1101 assert_equal 2, ActionTrackerNotification.find_all_by_action_tracker_id(first_activity.id).count
test/unit/scrap_test.rb
@@ -123,7 +123,8 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -123,7 +123,8 @@ class ScrapTest &lt; ActiveSupport::TestCase
123 end 123 end
124 124
125 should "notify leave_scrap action tracker verb to friends and itself" do 125 should "notify leave_scrap action tracker verb to friends and itself" do
126 - p1 = create_user.person 126 + User.current = create_user
  127 + p1 = User.current.person
127 p2 = create_user.person 128 p2 = create_user.person
128 p1.add_friend(p2) 129 p1.add_friend(p2)
129 process_delayed_job_queue 130 process_delayed_job_queue
@@ -141,7 +142,8 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -141,7 +142,8 @@ class ScrapTest &lt; ActiveSupport::TestCase
141 end 142 end
142 143
143 should "notify leave_scrap action tracker verb to members of the communities and the community itself" do 144 should "notify leave_scrap action tracker verb to members of the communities and the community itself" do
144 - p = create_user.person 145 + User.current = create_user
  146 + p = User.current.person
145 c = fast_create(Community) 147 c = fast_create(Community)
146 c.add_member(p) 148 c.add_member(p)
147 ActionTrackerNotification.delete_all 149 ActionTrackerNotification.delete_all
@@ -175,7 +177,8 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -175,7 +177,8 @@ class ScrapTest &lt; ActiveSupport::TestCase
175 end 177 end
176 178
177 should "notify leave_scrap_to_self action tracker verb to friends and itself" do 179 should "notify leave_scrap_to_self action tracker verb to friends and itself" do
178 - p1 = create_user.person 180 + User.current = create_user
  181 + p1 = User.current.person
179 p2 = create_user.person 182 p2 = create_user.person
180 p1.add_friend(p2) 183 p1.add_friend(p2)
181 ActionTrackerNotification.delete_all 184 ActionTrackerNotification.delete_all
@@ -290,7 +293,8 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -290,7 +293,8 @@ class ScrapTest &lt; ActiveSupport::TestCase
290 end 293 end
291 294
292 should 'create activity with reply_scrap_on_self when top_root scrap receiver is the same as sender' do 295 should 'create activity with reply_scrap_on_self when top_root scrap receiver is the same as sender' do
293 - s, r = create_user.person, create_user.person 296 + User.current = create_user
  297 + s, r = User.current.person, create_user.person
294 root = create(Scrap, :sender_id => s.id, :receiver_id => r.id) 298 root = create(Scrap, :sender_id => s.id, :receiver_id => r.id)
295 assert_difference 'ActionTracker::Record.count', 1 do 299 assert_difference 'ActionTracker::Record.count', 1 do
296 reply = create(Scrap, :sender => r, :receiver => s, :scrap_id => root.id, :content => 'sample') 300 reply = create(Scrap, :sender => r, :receiver => s, :scrap_id => root.id, :content => 'sample')