[rspec-users] Stubbing helper methods in controller specs when integrate_views is On

Krasimir Angelov krasimir.angelov at gmail.com
Wed Nov 25 11:02:20 EST 2009

Hi all,

I'm using rspec-caching-test-plugin to test caching (obviously) in my
controller specs. Because views are also involved in caching integrate_views
have to be turned On.
The problem comes when mock is passed to a helper, for examle


where porfile = mock_model(Profile)

The error thrown is "can't convert Spec::Mocks::Mock into String". Usually
when dealing with view specs in this case I'm just doing

template.stub!(:link_to_profile => '/link/to/profile')

and specing the helper method in separate helper spec, but in this case
(controller spec with integrate_views turned On) I have no access to
template object.

Is there any way to stub helper method or I just have to give away mocks and
use real records created with FactoryGirl instead?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091125/a9f5c416/attachment.html>

More information about the rspec-users mailing list