This happens when the top-level class is automatically loaded before using the namespace. If you have this code without preinstalling the class:
UsersController module AdminArea UsersController end
The first line will cause a permanent missing hook: "ok, UsersController does not exist, so try loading it."
But then, reaching the second line, UserController is really already defined at the top level. Thus, hook_ const_missing does not start, and the application will try to use a known constant.
To avoid this, explicitly require the correct classes on top of your specification files:
#spec/controllers/users_controller_spec.rb: require 'users_controller'
and
#spec/controllers/admin/users_controller_spec.rb require 'admin/users_controller'
Olivier el mekki
source share