Browse files

Fix issue #1928, thanks to @ejfinneran for a test case

  • Loading branch information...
1 parent 9678b42 commit cbc6926e3dc1699f8e9274ce180f4018fb7afdf6 @josevalim josevalim committed Jun 28, 2012
Showing with 14 additions and 1 deletion.
  1. +1 −1 Gemfile.lock
  2. +1 −0 lib/devise/test_helpers.rb
  3. +12 −0 test/test_helpers_test.rb
View
2 Gemfile.lock
@@ -87,7 +87,7 @@ GEM
omniauth-openid (1.0.1)
omniauth (~> 1.0)
rack-openid (~> 1.3.1)
- orm_adapter (0.1.0)
+ orm_adapter (0.3.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
View
1 lib/devise/test_helpers.rb
@@ -45,6 +45,7 @@ def warden #:nodoc:
def sign_in(resource_or_scope, resource=nil)
scope ||= Devise::Mapping.find_scope!(resource_or_scope)
resource ||= resource_or_scope
+ warden.instance_variable_get(:@users).delete(scope)
warden.session_serializer.store(resource, scope)
end
View
12 test/test_helpers_test.rb
@@ -47,6 +47,18 @@ def redirect
assert_response :success
end
+ test "does not redirect with valid user after failed first attempt" do
+ get :index
+ assert_response :redirect
+
+ user = create_user
+ user.confirm!
+
+ sign_in user
+ get :index
+ assert_response :success
+ end
+
test "redirects if valid user signed out" do
user = create_user
user.confirm!

0 comments on commit cbc6926

Please sign in to comment.