3

10.3.1 アクセス制御でのテストに問題がある:

    Failures:

    1) Authentication authorization for non-signed-in users in the Microposts controller submitting to the destroy action 
 Failure/Error: before { delete micropost_path(FactoryGirl.create(:micropost)) }
 NoMethodError:
   undefined method `micropost_path' for #<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 for non-signed-in users in the Microposts controller submitting to the create action 
 Failure/Error: before { post microposts_path }
 NameError:
   undefined local variable or method `microposts_path' for #<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)>'

これに追加しroutes.rbます:

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

しかし、それは役に立ちません。どういう意味undefined method 'micropost_path'ですか?どうすればいいのかわからない。

4

1 に答える 1