Cập nhật: Đây là do một tên sai chính tả tập tinActionController :: RoutingError: uninitialized liên tục MicropostsController
đúng:
~/sample_app/app/controllers/microposts_controller.rb
không đúng:
~/sample_app/app/controllers/microposts_contoller.rb
Đây là đóng góp đầu tiên của tôi ở đây, phản hồi về việc cải thiện điều này hoặc futu tái đăng được đánh giá cao :)
Ruby on Rails Hướng dẫn: Learn Web Development with Rails 4
Trong khi làm việc thông qua chương 10.3, tôi đã bị mắc kẹt. Cuối cùng, một tên tệp sai chính tả đã khiến tôi đuổi theo ma trong vài ngày.
$ 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
: đây là do một tên tập tin sai chính tả ~/sample_app /app/controllers/microposts_controller.rb (là microposts_contoller.rb) – 8legged
Không bình luận, trả lời câu hỏi của riêng bạn. – fotanus
Đồng ý bạn nên trả lời câu hỏi của bạn để người dùng không phải đọc toàn bộ bài đăng và nhận xét của bạn trước khi nhận ra rằng điều này đã được giải quyết. –