diff --git a/lib/authenticated_system.rb b/lib/authenticated_system.rb index e23b576..8726add 100644 --- a/lib/authenticated_system.rb +++ b/lib/authenticated_system.rb @@ -3,7 +3,7 @@ module AuthenticatedSystem protected def self.included base - if base.is_a? ActionController::Base + if base < ActionController::Base base.around_filter :user_set_current base.before_filter :login_from_cookie end diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb index a06af8f..6f98324 100644 --- a/test/functional/application_controller_test.rb +++ b/test/functional/application_controller_test.rb @@ -194,6 +194,7 @@ class ApplicationControllerTest < ActionController::TestCase User.expects(:current=).with do |user| user == testuser end.at_least_once + User.expects(:current=).with(nil) get :index end diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index b494f0a..1897fab 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -808,13 +808,11 @@ class ProfileControllerTest < ActionController::TestCase end should 'the network activity be paginated' do - p1= fast_create(Person) - 40.times{fast_create(ActionTrackerNotification, :action_tracker_id => fast_create(ActionTracker::Record), :profile_id => p1.id)} + User.current = user = create_user + p1 = user.person + 40.times{fast_create(ActionTrackerNotification, action_tracker_id: create(ActionTracker::Record, verb: :leave_scrap, user: p1, params: {content: 'blah'}), profile_id: p1.id)} @controller.stubs(:logged_in?).returns(true) - user = mock() - user.stubs(:person).returns(p1) - user.stubs(:login).returns('some') @controller.stubs(:current_user).returns(user) get :index, :profile => p1.identifier assert_equal 15, assigns(:network_activities).size @@ -965,7 +963,7 @@ class ProfileControllerTest < ActionController::TestCase should 'the activities be paginated in people profiles' do p1= fast_create(Person) - 40.times{create(Scrap, :receiver_id => p1.id, :created_at => Time.now)} + 40.times{create(Scrap, sender: p1, receiver: p1, created_at: Time.now)} @controller.stubs(:logged_in?).returns(true) user = mock() @@ -981,7 +979,7 @@ class ProfileControllerTest < ActionController::TestCase should 'the activities be paginated in community profiles' do p1= fast_create(Person) c = fast_create(Community) - 40.times{create(Scrap, :receiver_id => c.id)} + 40.times{create(Scrap, sender: p1, receiver: c)} @controller.stubs(:logged_in?).returns(true) user = mock() -- libgit2 0.21.2