summaryrefslogtreecommitdiff
path: root/users/test/functional/helper_methods_test.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-11-04 21:01:27 +0100
committerAzul <azul@leap.se>2012-11-04 21:01:27 +0100
commite1fc3f4850ee73e0591bd67a92b104db4f63e4cb (patch)
tree1207ce14cb1c2551a3fda09e7c670cc97182a0f6 /users/test/functional/helper_methods_test.rb
parentc0f92bf9f481463dcaef6f4b30343130a8910a00 (diff)
stubbing current_user the warden way
Diffstat (limited to 'users/test/functional/helper_methods_test.rb')
-rw-r--r--users/test/functional/helper_methods_test.rb15
1 files changed, 6 insertions, 9 deletions
diff --git a/users/test/functional/helper_methods_test.rb b/users/test/functional/helper_methods_test.rb
index c0eaf61..2b2375c 100644
--- a/users/test/functional/helper_methods_test.rb
+++ b/users/test/functional/helper_methods_test.rb
@@ -16,26 +16,23 @@ class HelperMethodsTest < ActionController::TestCase
@controller
end
- def test_current_user_with_caching
- @user = stub_logged_in
- assert_equal @user, current_user
- assert_equal @user, current_user # tests caching
+ def test_current_user
+ login
+ assert_equal @current_user, current_user
end
def test_logged_in
- @user = stub_logged_in
+ login
assert logged_in?
end
def test_logged_out
- stub_logged_out
assert !logged_in?
end
def test_admin
- bool = stub
- @user = stub_logged_in
- @user.expects(:is_admin?).returns(bool)
+ login
+ @current_user.expects(:is_admin?).returns(bool = stub)
assert_equal bool, admin?
end