My spec;
describe ‘subnav rendering while logged in’ do
before do
template.stub!(:logged_in?).and_return(true)
template.stub!
(:current_profile).at_least(:once).and_return(mock_profile)
end
def do_render
render "/homepages/show.html.erb"
end
it "should render the logged in partial for homepages" do
template.expect_render(:partial => 'shared/subnav/home', :locals
=> {:active => :home})
do_render
end
end
passes if I render the partial directly in the view,
render :partial => ‘shared/subnav/home’, :locals => {:active => :home}
but it fails if the partial is rendered by a helper;
module ApplicationHelper
def subnav(partial, args={})
active = args[:active] || :no_highlight
if partial == :home
partial = (logged_in? ? ‘home’ : ‘login’)
end
render :partial => “shared/subnav/#{partial}”, :locals => {:active
=> active}
end
end
Is there any way to check whether the helper renders it?