plataformatec/devise — Issue #1488: 1.5.0 release causes uncaught exception error in test
Author: wolframarnold
Created: 2011-12-06 19:05:05+00:00
State: open

I've got this test to check that my override for "active_for_authentication?" is working -- I'm using this to prevent barred users from authenticating, using a "disabled" flag in the database.

require 'spec_helper'

describe Devise::SessionsController do
include Devise::TestHelpers

before do
@client = Factory(:confirmed_client, :disabled_at => Time.now)
request.env["devise.mapping"] = Devise.mappings[:client]
end

it 'will not sign client in if disabled' do
post :create, :client => {:password => "password", :email => @client.email}
controller.should_not be_client_signed_in
end

it 'displays "Your account has been disabled..." message' do
post :create, :client => {:password => "password", :email => @client.email}
flash[:alert].should == "Your account has been disabled. Please call Customer Service at #{SITE[:support_phone]} for more information."
end
end

end