I was just playing around with doing just that, (work is still rails
1.2.6) with latest mocha, and I found found this works.
@controller.class.view_class.any_instance.stubs(:woo).returns(...)
I have not found a way to do it otherwise. I would have thought that
@response.template.stubs(:woo).returns(...) would have worked, but it
did not for me.
module Decoratordef fooendendclass Model < ActiveRecord::Baseendclass ModelsController < ApplicationControllerdef bar@model = Model.find(params[:id])@model.extend(Decorator)@model.fooendend
test "bar" doModel.any_instance.expects(:foo).returns("bar")get :barend