[rspec-users] get to a different controller

David Chelimsky dchelimsky at gmail.com
Tue Jan 5 15:37:10 EST 2010


On Tue, Jan 5, 2010 at 1:46 PM, Matt Wynne <matt at mattwynne.net> wrote:

> Subclass it in your spec with
>
> class TestController < Admin::BaseController
>   def index
>   end
> end
>
> ...then use the TestController in your tests for Admin::BaseController.
>
> That might mean you'll need to add special routing for TestController which
> is annoying but can be done.


>From The RSpec Book:

http://media.pragprog.com/titles/achbd/code/rails_controllers/messages/15/spec/controllers/application_controller5_spec.rb


>
> On 5 Jan 2010, at 17:36, Phillip Koebbe wrote:
>
>  I'm trying to implement a base controller that other controllers descend
>> from, and am having a bit of difficulty in testing the sole "feature" of the
>> base controller.
>>
>> http://gist.github.com/269544
>>
>> In the "not redirecting when user is an admin" context, I keep getting an
>> error that "no action responded to <whatever I try>". Obviously, there are
>> no actions in this controller, nor should there be. I want to hit an action
>> in a descendant controller and make sure that it goes through.
>>
>> How do I do that?
>>
>> Thanks,
>> Phillip
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
>
> cheers,
> Matt
>
> http://mattwynne.net
> +447974 430184
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100105/56ac72c3/attachment.html>


More information about the rspec-users mailing list