On Tue, Dec 4, 2012 at 10:16 AM, Perry Smith <pedz...@gmail.com> wrote:
>
> On Dec 4, 2012, at 7:06 AM, David Chelimsky wrote:
>
>> On Tue, Dec 4, 2012 at 3:47 AM, LesNightingill <codehac...@comcast.net> 
>> 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)
>
> New to the group so this is as much a question as a suggestion:
>
> can you attach it to ApplicationController ?

You can if it's a class method, not an instance method.

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


Reply via email to