This happens when a top level class get autoloaded before a namespaced one is used. If you have this code without any class preloaded :
UsersController
module AdminArea
UsersController
end
The first line will trigger constant missing hook : "ok, UsersController does not exist, so let's try to load it".
But then, reaching the second line, UsersController is indeed already defined, at top level. So, there's no const_missing hook triggered, and app will try to use the known constant.
To avoid that, explicitly require proper classes on top of your spec files :
#spec/controllers/users_controller_spec.rb:
require 'users_controller'
And
#spec/controllers/admin/users_controller_spec.rb
require 'admin/users_controller'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…