Skip to content

Instantly share code, notes, and snippets.

@mytrile
Created November 8, 2012 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mytrile/f7da7d905227324c932a to your computer and use it in GitHub Desktop.
Save mytrile/f7da7d905227324c932a to your computer and use it in GitHub Desktop.
class CustomAuthenticationFailure < Devise::FailureApp
protected
def redirect_url
"/"
end
end
# ...
config.warden do |manager|
manager[:default_strategies][:user].unshift :token_cookie_strategy
end
config.warden do |manager|
manager.failure_app = CustomAuthenticationFailure
end
# ...
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