-
-
Save mytrile/f7da7d905227324c932a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomAuthenticationFailure < Devise::FailureApp | |
protected | |
def redirect_url | |
"/" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
config.warden do |manager| | |
manager[:default_strategies][:user].unshift :token_cookie_strategy | |
end | |
config.warden do |manager| | |
manager.failure_app = CustomAuthenticationFailure | |
end | |
# ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe UsersController do | |
before :each do | |
@user = FactoryGirl.create(:user) | |
end | |
describe "User can log in using a token in a signed cookie" do | |
it "logs in with token in cookie" do | |
@user.ensure_authentication_token! | |
cookies[:authentication_token] = @user.authentication_token | |
get :personal | |
response.should render_template("personal") | |
# THE RESPONSE IS REDIRECT | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment