Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionController::RoutingError: uninitialized constant MicropostsController

Tags:

Update: This was due to a misspelled file name

correct:
~/sample_app/app/controllers/microposts_controller.rb

incorrect:
~/sample_app/app/controllers/microposts_contoller.rb


This is my first contribution here, feedback on improving this or future postings is appreciated :)

Ruby on Rails Tutorial: Learn Web Development with Rails 4

While working through chapter 10.3, I got stuck. In the end, a misspelled file name had me chasing ghosts for a few days.

$ 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 
like image 754
8legged Avatar asked Aug 22 '13 21:08

8legged


1 Answers

This was due to a misspelled file name ~/sample_app/app/controllers/microposts_controller.rb (was microposts_contoller.rb)

like image 168
8legged Avatar answered Oct 09 '22 11:10

8legged