use let instead of before hook

This commit is contained in:
Vasiliy Ermolovich 2012-03-19 00:01:52 +03:00 committed by Steve Klabnik
parent 211a657b91
commit f7791ab7e3
1 changed files with 4 additions and 4 deletions

View File

@ -1,16 +1,16 @@
require 'spec_helper'
describe Draper::HelperSupport do
before(:each){ @product = Product.new}
let(:product){ Product.new }
context '#decorate' do
it 'renders a block' do
output = ApplicationController.decorate(@product){|p| p.model.object_id }
output.should == @product.object_id
output = ApplicationController.decorate(product){|p| p.model.object_id }
output.should == product.object_id
end
it 'uses #capture so Rails only renders the content once' do
ApplicationController.decorate(@product){|p| p.model.object_id }
ApplicationController.decorate(product){|p| p.model.object_id }
ApplicationController.capture_triggered.should be
end
end