On Tue, Dec 4, 2012 at 3:47 AM, LesNightingill <[email protected]> wrote:
> I have Rails app with a helper method "current_user_permitted?" in
> app/helpers/application_helper.rb
> Since it has some complex dependencies, I want to mock it for my Rspec
> integration tests.

Not recommended (integration tests are intended to test those
dependencies), but you can use any_instance on each of the controllers
that might be used in the example:

FooController.any_instance.stub(:current_user_permitted? => true)

HTH,
David

>
> The question is:
> On what class do I need to create a mock, so that I can force this helper to
> always return true?
>
> Thanks in advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "rspec" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rspec/-/dSOQ4tdqr_MJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to