I am following the Michael Hartle Rails tutorial at the moment, and I managed to reach 7.22 without any major glitches. However, the test result puzzles me:
Failures: 1) UserPages signup with invalid information should not create a user Failure/Error: expect{click_button submit }.not_to change(User, :count) AbstractController::ActionNotFound: The action 'create' could not be found for UsersController
I added the following to my users page as indicated in the tutorial:
class UsersController < ApplicationController def show @user = User.find(params[:id]) end def new @user = User.new end end
but it still does not work. I tried adding the create method, but that just throws the missing template error ...
In case this helps here, the rake routes team command:
~/dev/rails/sample_app$ rake routes users GET /users(.:format) users
In response to a comment, tests that fail are as follows:
describe "signup" do before{ visit signup_path } let(:submit) {"Create my account"} describe "with invalid information" do it "should not create a user" do expect{click_button submit }.not_to change(User, :count) end end describe "with valid information" do before do fill_in "Name", with: "Example User" fill_in "Email", with: " user@example.com " fill_in "Password", with: "foobar" fill_in "Confirmation", with: "foobar" end it "should create a user" do expect{click_button submit}.to change(User, :count).by(1) end end end
Thanks in advance for any advice!
source share