[rspec-users] stubbing out helper method in helper spec

Ingo Weiss ingo at ingoweiss.com
Thu Sep 6 11:32:42 EDT 2007


Hi,

I am stuck with a problem in my helper specs. Say I have a helper  
with two methods, method1 and method2, where method2 is calling  
method1 internally. How can I stub out method1 when testing method2?  
I guess it boils down to how I can access the helper object from  
within a helper spec.

   it 'should behave_correctly' do
     ???.stub!(:method1).and_return('mock')
     method2.should eql('...')
   end

Thanks!
Ingo




More information about the rspec-users mailing list