I have a helper method
def partial_path_for(partial, options = {})
base_path = options[:base_path] || self.template.base_path
"_partials/#{base_path}/#{partial}"
end
and use it in a template (haml) like
= render :partial => partial_path_for(:details)
I'd like to have a similar helper for view specs so I can do this
describe 'web/admin/merchants/show.html.haml' do
before(:each) do
@merchant = stub_model(Merchant, :name => 'Some Merchant')
assigns[:merchant] = @merchant
end
it 'should render the details partial' do
partial_path = partial_path_for(:details, :base_path =>
self.template.base_path)
template.should_receive(:render).with(:partial => partial_path)
render
end
it_should_behave_like 'merchant details'
end
Unfortunately, if I debug right before the template.should_receive
statement, self.template.base_path is nil. How can I get the path to the
template?
Thanks,
Phillip
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users