Speed up Rspec testing!!! Thank you thank you.
Recently, I get into problem while running controller spec. Iam using rspec with capybara and using devise gem for user authentication. While testing controller, I need to login a user. I tried to use Devise built in helper method
sign_out to manage user login logout, but it is not working at all. After, a lot of googling I find the solution atcapybara wiki.
Devise’s built in
sign_out methods is not working because these require direct access to the request object which is not available while using Capybara. If, you are aware, Devise itself build over warden interface and warden do provide test helper to manage user login logout. So by, including warden test helper in controller spec, we can manage user login logout. The method provided by warden is: login_as and logout.
The sample code from one of my controller spec is as below
View original post 174 more words