Leave a comment


Speed up Rspec testing!!! Thank you thank you.

codedecoder

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_in and 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_in and 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

require…

View original post 174 more words

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: