Currently in my spec / decorators / product_decorator_spec.rb I have the following:
require 'spec_helper' describe ProductDecorator do let(:product) { FactoryGirl.create(:product) } subject do ProductDecorator.first end before do product end it 'should render the name attribute with a link to the product page' do subject.name.should == h.link_to(product.name, 'test') end end
When I run my spec, I get the following:
F..... Failures: 1) ProductDecorator should render the name attribute with a link to the product page Failure/Error: subject.name.should == h.link_to(product.name, 'resr') NameError: undefined local variable or method `h' for #<RSpec::Core::ExampleGroup::Nested_2:0x007fbbf212c8b0> # ./spec/decorators/product_decorator_spec.rb:15:in `block (2 levels) in <top (required)>' Finished in 0.98531 seconds 6 examples, 1 failure Failed examples: rspec ./spec/decorators/product_decorator_spec.rb:14 # ProductDecorator should render the name attribute with a link to the product page
According to the documentation, the specifications placed in the decorator folder should have access to the helper method, however my specification does not work. I also tried manually tagging my specifications, but it seems to have no effect.
Thanks for watching.
source share