summaryrefslogtreecommitdiff
path: root/users/test/support
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2012-11-12 10:48:40 -0800
committerjessib <jessib@riseup.net>2012-11-12 10:48:40 -0800
commit347c1d73c855cfad8c37e8a0bd98a60831151812 (patch)
tree104c89712d9a1f7d7eefd49187a2f6bbc70a33ce /users/test/support
parent67cb22d50193a58e4697549d9ce8a22e790a7a0d (diff)
parentfe8b49232d31681667badaaeff7aa4d0a40445ea (diff)
Merge branch 'develop' into help_develop
Conflicts: help/test/functional/tickets_controller_test.rb users/test/functional/application_controller_test.rb users/test/support/auth_test_helper.rb
Diffstat (limited to 'users/test/support')
-rw-r--r--users/test/support/auth_test_helper.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/users/test/support/auth_test_helper.rb b/users/test/support/auth_test_helper.rb
index 37aef34..795a977 100644
--- a/users/test/support/auth_test_helper.rb
+++ b/users/test/support/auth_test_helper.rb
@@ -1,18 +1,18 @@
module AuthTestHelper
+ extend ActiveSupport::Concern
- def stub_logged_in
- @user_id = stub
- @user = stub
- session[:user_id] = @user_id
- User.expects(:find).once.with(@user_id).returns(@user)
- return @user
+ # Controller will fetch current user from warden.
+ # Make it pick up our current_user
+ included do
+ setup do
+ request.env['warden'] ||= stub :user => nil
+ end
end
- def stub_logged_out
- #todo: this seems wrong.
- @user_id = stub
- session[:user_id] = @user_id
- User.expects(:find).once.with(@user_id).returns(nil)
+ def login(user = nil)
+ @current_user = user || stub
+ request.env['warden'] = stub :user => @current_user
+ return @current_user
end
def assert_access_denied(denied = true, logged_in = true)