The rspec test fails when trying to click_button "Create my account" saying "The action 'create' could not be found for UsersController.
I'm assuming that this is a RESTful problem where it's defaulting to POST instead of GET (or something like that). Why oh why else would it be trying to call 'create' instead of 'new'? In the next section - 7.3 - a 'create' action is defined but the tutorial says that tests should be passing by the end of 7.2.2.
On the other hand, I could simply be missing something. That's why I'm not writing to admin at the tutorial site.
I'd post my code but I've verified that it's the same as the tutorial's examples: http://ruby.railstutorial.org/chapters/sign-up?version=3.2#sec:signup_form
I know this is old but I've just had this same problem and I'll post this in case anyone new needs help.
What confused me was the sentence in 7.2.2: "With the @user variable so defined, the test for the signup page should be passing again." But my tests were failing even though my code was exactly the same as the example.
The problem was, not all the tests should be passing - Hartl is only talking about the "signup page" tests. At this point some tests under "signup" should be failing.
If you run the command Hartl gives you should see that the right tests do pass:
bundle exec rspec spec/requests/user_pages_spec.rb -e "signup page"
I'd just been being lazy and only typing bundle exec rspec spec/
, which ran the failing tests too.
No, you are not missing anything. It seems you are catching a slight doco error.
Indeed, Hartl says so right in the beginning of 7.3.1 "Our first step is to eliminate the error that currently results when submitting the signup form, as you can verify in your browser or * by running the test for signup with invalid information *" (my emphasis).
Still, I'd like him to clear this up as well, there seems to be just a little more to this. I also happen to be not catching any regex errors for poorly formed email addresses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With