ruby - Michael Hartl Rails Tutorial chapter 7 error Action not found in UsersController -
i'm following michael hartl's rails tutorial @ moment , i've managed 7.22 without major hitches. i'm stumped output testing says:
failures: 1) userpages signup invalid information should not create user failure/error: expect{click_button submit }.not_to change(user, :count) abstractcontroller::actionnotfound: action 'create' not found userscontroller # (eval):2:in `click_button' # ./spec/requests/user_pages_spec.rb:29:in `block (5 levels) in <top (required)>' # ./spec/requests/user_pages_spec.rb:29:in `block (4 levels) in <top (required)>' 2) userpages signup valid information should create user failure/error: expect{click_button submit}.to change(user, :count).by(1) abstractcontroller::actionnotfound: action 'create' not found userscontroller # (eval):2:in `click_button' # ./spec/requests/user_pages_spec.rb:42:in `block (5 levels) in <top (required)>' # ./spec/requests/user_pages_spec.rb:42:in `block (4 levels) in <top (required)>' finished in 0.7718 seconds 6 examples, 2 failures i've added following users controllers page instructed tutorial:
class userscontroller < applicationcontroller def show @user = user.find(params[:id]) end def new @user = user.new end end but still doesn't seem work. i've tried adding create method throws missing template error...
in case helps here's output of rake routes command:
~/dev/rails/sample_app$ rake routes users /users(.:format) users#index post /users(.:format) users#create new_user /users/new(.:format) users#new edit_user /users/:id/edit(.:format) users#edit user /users/:id(.:format) users#show put /users/:id(.:format) users#update delete /users/:id(.:format) users#destroy root / static_pages#home signup /signup(.:format) users#new /help(.:format) static_pages#help /about(.:format) static_pages#about contact /contact(.:format) static_pages#contact in response comment, tests failing are:
describe "signup" before{ visit signup_path } let(:submit) {"create account"} describe "with invalid information" "should not create user" expect{click_button submit }.not_to change(user, :count) end end describe "with valid information" before fill_in "name", with: "example user" fill_in "email", with: "user@example.com" fill_in "password", with: "foobar" fill_in "confirmation", with: "foobar" end "should create user" expect{click_button submit}.to change(user, :count).by(1) end end end thanks in advance advice!
the tests shouldn't passing @ point. keep following tutorial , you'll see how works.
Comments
Post a Comment