Commit cbd6f636046425444eaa78665574b234ced86a51

Authored by Braulio Bhavamitra
1 parent 10e7ec44

rails4: fix functionals test after merge

lib/authenticated_system.rb
... ... @@ -3,7 +3,7 @@ module AuthenticatedSystem
3 3 protected
4 4  
5 5 def self.included base
6   - if base.is_a? ActionController::Base
  6 + if base < ActionController::Base
7 7 base.around_filter :user_set_current
8 8 base.before_filter :login_from_cookie
9 9 end
... ...
test/functional/application_controller_test.rb
... ... @@ -194,6 +194,7 @@ class ApplicationControllerTest &lt; ActionController::TestCase
194 194 User.expects(:current=).with do |user|
195 195 user == testuser
196 196 end.at_least_once
  197 + User.expects(:current=).with(nil)
197 198 get :index
198 199 end
199 200  
... ...
test/functional/profile_controller_test.rb
... ... @@ -808,13 +808,11 @@ class ProfileControllerTest &lt; ActionController::TestCase
808 808 end
809 809  
810 810 should 'the network activity be paginated' do
811   - p1= fast_create(Person)
812   - 40.times{fast_create(ActionTrackerNotification, :action_tracker_id => fast_create(ActionTracker::Record), :profile_id => p1.id)}
  811 + User.current = user = create_user
  812 + p1 = user.person
  813 + 40.times{fast_create(ActionTrackerNotification, action_tracker_id: create(ActionTracker::Record, verb: :leave_scrap, user: p1, params: {content: 'blah'}), profile_id: p1.id)}
813 814  
814 815 @controller.stubs(:logged_in?).returns(true)
815   - user = mock()
816   - user.stubs(:person).returns(p1)
817   - user.stubs(:login).returns('some')
818 816 @controller.stubs(:current_user).returns(user)
819 817 get :index, :profile => p1.identifier
820 818 assert_equal 15, assigns(:network_activities).size
... ... @@ -965,7 +963,7 @@ class ProfileControllerTest &lt; ActionController::TestCase
965 963  
966 964 should 'the activities be paginated in people profiles' do
967 965 p1= fast_create(Person)
968   - 40.times{create(Scrap, :receiver_id => p1.id, :created_at => Time.now)}
  966 + 40.times{create(Scrap, sender: p1, receiver: p1, created_at: Time.now)}
969 967  
970 968 @controller.stubs(:logged_in?).returns(true)
971 969 user = mock()
... ... @@ -981,7 +979,7 @@ class ProfileControllerTest &lt; ActionController::TestCase
981 979 should 'the activities be paginated in community profiles' do
982 980 p1= fast_create(Person)
983 981 c = fast_create(Community)
984   - 40.times{create(Scrap, :receiver_id => c.id)}
  982 + 40.times{create(Scrap, sender: p1, receiver: c)}
985 983  
986 984 @controller.stubs(:logged_in?).returns(true)
987 985 user = mock()
... ...