melissawahnish / ruby-thursday

15 stars 11 forks source link

Issues with factory-girl devise video #4

Open dmc2015 opened 7 years ago

dmc2015 commented 7 years ago

I had a question about this video: https://www.youtube.com/watch?v=zS5opOeWFhA

I keep getting this error,

bash
Failures:

  1) signing in visiting the site to sign in
     Failure/Error: expect(page).to have_content("Signed in successfully.")
       expected to find text "Signed in successfully." in "Sign in Log in Email Password Remember me Sign up Forgot your password?"
     # ./spec/features/signin_spec.rb:15:in `block (2 levels) in <top (required)>'

Finished in 7.38 seconds (files took 3.93 seconds to load)
4 examples, 1 failure

Basically it looks like it sees text but not the expected text and the text it sees is the text prior to the log in attempt.

I was wondering if you had any idea why it is failing.

I noticed that we use the click_link for 'Sign in' prior to filling the fields of the user data which seemed like it might be in the wrong order.

I reversed the order in pry and it still did not pass. I have tested the login manually by providing seed data also to confirm that there are no spelling or case sensitivity issues.

Here is my repo: https://github.com/dmc2015/factory-girl-testing

melissawahnish commented 7 years ago

Hi! You are forgetting to submit the form. You need to add this at the end of the fill_in_signin_field method:

click_button "Log in"

I often forget to submit the form! :)

dmc2015 commented 7 years ago

Thanks so much! I guess I didn't realize there were two button clicks.

Do you remember if you ever reviewed how to do the same, login with devise then run a test, for controller tests?