【发布时间】:2013-08-25 19:25:53
【问题描述】:
更新:这是由于文件名拼写错误
正确:~/sample_app/app/controllers/microposts_controller.rb
不正确:~/sample_app/app/controllers/microposts_contoller.rb
这是我在这里的第一个贡献,感谢您对改进此帖子或未来帖子的反馈:)
Ruby on Rails 教程:Learn Web Development with Rails 4
在阅读章节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
【问题讨论】:
-
更新:这是由于文件名拼写错误 ~/sample_app/app/controllers/microposts_controller.rb(原为 microposts_contoller.rb)
-
不要评论,回答你自己的问题。
-
同意你应该回答你的问题,这样用户就不必通读你的整个帖子和 cmets 就意识到这个问题已经解决了。
-
对不起,我没有足够的积分 - 它不会让我再过 7 个小时回答。我会在顶部添加一些内容。
标签: ruby-on-rails ruby-on-rails-4 railstutorial.org