Create a gist now

Instantly share code, notes, and snippets.

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