[rspec-users] RSpec and namespaced controllers

Bruno Bornsztein bruno.bornsztein at gmail.com
Sat Mar 24 15:15:51 EDT 2007

I'm running into a problem with RSpec/Rails and namespaced controllers.
I've got a controller called 'TenantsController' in app/controllers
and another called 'Admin::TenantsController' in app/controllers/admin

In spec/controllers/, I have a tenants_controller_spec.rb. In
spec/controllers/admin/ I have another tenants_controller_spec.rb.
Both specs run correctly when I run them individually from ruby (ie ruby
spec/controllers/admin/tenants_controller.rb), but the namespaced
tenants_controller.rb (inside /admin) fails when I run the tests from rake.

I think there's a collision between the two controller name, or else
RSpec/Rails isn't parsing the second controller's name correctly.
For reference, in /admin/tenants_controller_spec.rb, I'm setting the
controller_name as:

controller_name 'admin/tenants'

Any thoughts on what might be going wrong?
Bruno Bornsztein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070324/e31bb651/attachment.html 

More information about the rspec-users mailing list