Question

first, sorry for the bad english.

I have a test that submit a login form. after redirect, when I test for a message 'successfully logged...' then my page.body is

'<h1>Not Found</h1>'

but this works perfectly on browser manual test.

what should I'm doing wrong?

Was it helpful?

Solution

Sounds likely that one of your steps is redirecting in a way that you do not expect.

  1. Check your before filters on the controller and application_controller to determine whether a login/I18n filter is redirecting your page.

  2. If you have the launchy gem installed, you can also add the following to your steps:

    And show me the page
    

    Which will fire-up a browser with what capybara is actually looking at, which is useful for sanity checking your steps.

Good luck!

OTHER TIPS

Tests run under their own clean copy of the database. Make sure you've set it up first using rake db:test:prepare, and that you're creating all the data you need for your tests as part of the feature. (I.e. Given there is a user named "Joe"...)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top