[rspec-users] Testing controller plugin

Phillip Koebbe phillipkoebbe at gmail.com
Mon Feb 8 10:58:31 EST 2010


Matt Wynne wrote:
>
> Yeah, you need to convince RSpec that the describe blocks you're using 
> are describing an ExampleGroup that's about a Rails Controller, then 
> it will mix in the right methods for you. I think you can do something 
> like:
>
> describe MySpecialTestController, :type => :controller do
> end
>
> That's the general idea. I think someone else on the list will be able 
> to help more than me with the specifics.
>
> As for a plug-in, I don't know any off-hand... try a few popular ones 
> out on github and look for a spec directory in the root I guess.
>

Thanks, again, Matt for taking the time to respond. I was kind of 
surprised by how many plugins use test::unit. I did finally find 
subdomain_fu [1] and was able to get something working. However, this 
approach tests the controller in a project and requires rspec-rails to 
be installed for the project. I would really like to be able to test 
this independent of a project. So if anyone knows how to test a 
controller plugin with RSpec independent of a project, I'd really 
appreciate some pointers.

Here's what I have right now:

http://gist.github.com/298281

Thanks,
Phillip


[1] http://github.com/mbleigh/subdomain-fu


More information about the rspec-users mailing list