문제

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?

도움이 되었습니까?

해결책

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!

다른 팁

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"...)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top