Chirag Shah
2012-Apr-06 06:19 UTC
i can not get current_user while writing test case with Rspec and Capybara
0 down vote favorite share [g+] share [fb] share [tw] I have to write test case for my one feature listing page and that feature index method has code like below def index @features = current_user.features end Now when i try to write test case for this then it throws error for ''undefined method features for nil class'' because it can not get the current user Now what i have do is below I have write the login process in the before each statement and then write the test case for the features listing page Can you please let me know that how i can get the current_user ? FYI, I have used devise gem -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Apparently Analagous Threads
- Cucumber/RSpec ::: Capybara? Webrat What am I using??
- Rails 3 - How can you get access to current_user in the IRB console?
- RSpec/rails & Capybara: #within
- Having difficulty testing redirects with Rspec and Capybara
- using restful_authentication current_user inside controller specs