更新:這是由於拼寫錯誤的文件名的ActionController :: RoutingError:未初始化不斷MicropostsController
正確:
~/sample_app/app/controllers/microposts_controller.rb
不正確:
~/sample_app/app/controllers/microposts_contoller.rb
這是我在這裏做出的第一個貢獻,就是改善這個還是futu的反饋重新張貼理解:)
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(was microposts_contoller.rb) – 8legged
不要評論,回答你自己的問題。 – fotanus
同意你應該回答你的問題,以便用戶在意識到這個問題已經解決之前不必閱讀你的整篇文章和評論。 –