rails, rspec, capybara, webkit/selenium, devise, logged out after every request
I was having this exact same problem and eventually came across this question with pretty much the same problem: Why is Capybara discarding my session after one event?
The solution is to include the snippet found here in your rails_helper
class ActiveRecord::Base mattr_accessor :shared_connection @@shared_connection = nil def self.connection @@shared_connection || retrieve_connection endend# Forces all threads to share the same connection. This works on# Capybara because it starts the web server in a thread.ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection