更新:这是由于文件名拼写错误
正确的:
~/sample_app/app/controllers/microposts_controller.rb
不正确:
~/sample_app/app/controllers/microposts_contoller.rb
这是我在这里的第一个贡献,感谢您对改进此帖子或未来帖子的反馈 :)
Ruby on Rails 教程:使用 Rails 4 学习 Web 开发
在完成第10.3章时,我被卡住了。最后,一个拼写错误的文件名让我追了几天鬼。
$ rspec spec/requests/authentication_pages_spec.rb
No DRb server is running. Running in local process instead ...
...FF................
Failures:
1) Authentication authorization for non-signed-in users in the Microposts controller submitting to the create action
Failure/Error: before { post microposts_path }
ActionController::RoutingError:
uninitialized constant MicropostsController
# ./spec/requests/authentication_pages_spec.rb:93:in `block (6 levels) in '
2) 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)) }
ActionController::RoutingError:
uninitialized constant MicropostsController
# ./spec/requests/authentication_pages_spec.rb:98:in `block (6 levels) in '
Finished in 0.92253 seconds
21 examples, 2 failures
Failed examples:
rspec ./spec/requests/authentication_pages_spec.rb:94 # Authentication authorization for non-signed-in users in the Microposts controller submitting to the create action
rspec ./spec/requests/authentication_pages_spec.rb:99 # Authentication authorization for non-signed-in users in the Microposts controller submitting to the destroy action