在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'
?我不知道该怎么办。