Commit cbd6f636046425444eaa78665574b234ced86a51
1 parent
10e7ec44
Exists in
master
and in
20 other branches
rails4: fix functionals test after merge
Showing
3 changed files
with
7 additions
and
8 deletions
Show diff stats
lib/authenticated_system.rb
@@ -3,7 +3,7 @@ module AuthenticatedSystem | @@ -3,7 +3,7 @@ module AuthenticatedSystem | ||
3 | protected | 3 | protected |
4 | 4 | ||
5 | def self.included base | 5 | def self.included base |
6 | - if base.is_a? ActionController::Base | 6 | + if base < ActionController::Base |
7 | base.around_filter :user_set_current | 7 | base.around_filter :user_set_current |
8 | base.before_filter :login_from_cookie | 8 | base.before_filter :login_from_cookie |
9 | end | 9 | end |
test/functional/application_controller_test.rb
@@ -194,6 +194,7 @@ class ApplicationControllerTest < ActionController::TestCase | @@ -194,6 +194,7 @@ class ApplicationControllerTest < ActionController::TestCase | ||
194 | User.expects(:current=).with do |user| | 194 | User.expects(:current=).with do |user| |
195 | user == testuser | 195 | user == testuser |
196 | end.at_least_once | 196 | end.at_least_once |
197 | + User.expects(:current=).with(nil) | ||
197 | get :index | 198 | get :index |
198 | end | 199 | end |
199 | 200 |
test/functional/profile_controller_test.rb
@@ -808,13 +808,11 @@ class ProfileControllerTest < ActionController::TestCase | @@ -808,13 +808,11 @@ class ProfileControllerTest < ActionController::TestCase | ||
808 | end | 808 | end |
809 | 809 | ||
810 | should 'the network activity be paginated' do | 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 | @controller.stubs(:logged_in?).returns(true) | 815 | @controller.stubs(:logged_in?).returns(true) |
815 | - user = mock() | ||
816 | - user.stubs(:person).returns(p1) | ||
817 | - user.stubs(:login).returns('some') | ||
818 | @controller.stubs(:current_user).returns(user) | 816 | @controller.stubs(:current_user).returns(user) |
819 | get :index, :profile => p1.identifier | 817 | get :index, :profile => p1.identifier |
820 | assert_equal 15, assigns(:network_activities).size | 818 | assert_equal 15, assigns(:network_activities).size |
@@ -965,7 +963,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -965,7 +963,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
965 | 963 | ||
966 | should 'the activities be paginated in people profiles' do | 964 | should 'the activities be paginated in people profiles' do |
967 | p1= fast_create(Person) | 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 | @controller.stubs(:logged_in?).returns(true) | 968 | @controller.stubs(:logged_in?).returns(true) |
971 | user = mock() | 969 | user = mock() |
@@ -981,7 +979,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -981,7 +979,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
981 | should 'the activities be paginated in community profiles' do | 979 | should 'the activities be paginated in community profiles' do |
982 | p1= fast_create(Person) | 980 | p1= fast_create(Person) |
983 | c = fast_create(Community) | 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 | @controller.stubs(:logged_in?).returns(true) | 984 | @controller.stubs(:logged_in?).returns(true) |
987 | user = mock() | 985 | user = mock() |