Jump to content

The ultimate community for Ruby on Rails developers.


uninitialized constant UsersController (NameError)

  • Please log in to reply
1 reply to this topic

#1 ChrisH



  • Members
  • 3 posts

Posted 02 June 2014 - 09:02 AM

I ran an bundle install / update to install a new gem and it installed a new version of rspec which apparently broke my tests!

It started with that all path variables was defined, which I got to work again, but now I get this error:

./spec/controllers/users_controller_spec.rb:3:in `<top (required)>': uninitialized constant UsersController (NameError)

If I remove the spec for the controller (only controller I test with a controller spec) I get this instead:

./spec/helpers/application_helper_spec.rb:3:in `<top (required)>': uninitialized constant ApplicationHelper (NameError)

Everything worked fine before the update and the application still works as expected, any ideas?!?

My google-fu is failing me and tight now my best solution is to toss my changes and reset to a previous commit.

#2 ajaysahu



  • Members
  • 30 posts

Posted 23 September 2014 - 10:58 AM

Using gem 'rspec-rails' causes such problems. I suspect latest version breaking it up. 
Try  using below version. 

group :development, :test do
    gem "rspec-rails", "~> 2.14.0"
    gem 'minitest'

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users