ruby on rails 3 - railstutorial 10.3.1: undefined local variable or method `microposts_path', `micropost_path' -


have problem testing in 10.3.1 access control:

    failures:      1) authentication authorization non-signed-in users in microposts controller submitting destroy action   failure/error: before { delete micropost_path(factorygirl.create(:micropost)) }  nomethoderror:    undefined method `micropost_path' #<rspec::core::examplegroup::nested_3::nested_3::nested_1::nested_3::nested_2:0x00000004edd970>  # ./spec/requests/authentication_pages_spec.rb:117:in `block (6 levels) in <top (required)>'      2) authentication authorization non-signed-in users in microposts controller submitting create action   failure/error: before { post microposts_path }  nameerror:    undefined local variable or method `microposts_path' #<rspec::core::examplegroup::nested_3::nested_3::nested_1::nested_3::nested_1:0x0000000521c758>  # ./spec/requests/authentication_pages_spec.rb:112:in `block (6 levels) in <top (required)>' 

i add in routes.rb this:

 resources :misroposts, only: [:create, :destroy] 

but don't help. means undefined method 'micropost_path'? don't know do.

do have line resources :microposts, only: [:create, :destroy] in routes.rb? check out listing 10.22.

that create 2 named routes, microposts_path (accessible post request) , micropost_path (accessible delete request), can see (along other paths in app) if type rake routes console.

check out table 7.1 of tutorial - that's happens when add resources :users routes.rb.

resources :microposts, only: [:create, :destroy] work same way, except, of course, create , destroy actions, explained in table 10.2.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -