Não mais allow(helper).to receive(:render)
Esta breve essência mostra como adicionar stub_template
testes auxiliares
module HelperExamplesExtensions
# Copy of stub_template from view specs
# @see RSpec::Rails::ViewExampleGroup::ExampleMethods#stub_template
def stub_template(hash) view.view_paths.unshift(ActionView::FixtureResolver.new(hash))
end
end
RSpec.configure do |config|
config.include HelperExamplesExtensions, type: :helper
end
exemplo verde:
it 'should render object' do
stub_template 'objects/_object.html.slim' => 'h1 object'
concat helper.render_object(object)
assert_select 'h1', text: 'object'
end