I\'m building a Rails 3 app using Devise, with Capybara for UI testing. The following test is failing:
class AuthenticationTest < ActionController::Integ
I had the same issue with a setup fairly similar to yours. In my case, switching to ActiveRecord sessions in the initializer solved the problem.
Additionally, make sure you call @user.skip_confirmation! if you are using the "confirmable" module in devise.
I was having the same issue and found a thread with a solution:
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
For the DatabaseCleaner stuff to work you'll need to include the database_cleaner
gem. If you haven't used it before, you may need to rake db:test:prepare
before rerunning your tests. I hope this works for you, too!
I've run into a similar problem before. Setting the password directly has some weird effects because it's supposed to be encrypted and stored with a salt--sometimes it works for me and other times it doesn't. I have a hard time remembering which specific cases were problematic. I'd recommend the following, in this order (for simplicity)
debugger
as the first line in your sessions_controller
. Then check params
and make sure the password is correct and in params[:user][:password]
.sessions_controller
, then you can find your Devise path with bundle show devise
. Then look for the create
action within (devise path)/app/controllers/devise/sessions_controller.rb