I would like to include some dynamic data in my test output.
if I write a test like this then it prints out "it should have '' things"
I figure I'm getting confused with rspec's magic and ruby's blocks as closures.
I can stick at count in a method outside the block but that seems hack-ish.
Any pointers?
describe 'things' do
before :all do
@count = 3
end
it "should have #{@count} things" do
#....
page.should have_content("entries: #{@count}")
end
end
if I write a test like the above then it prints out "it should have '' things"
Edit: Another, more specific example
describe 'things' do
before :all do
@thing = FactoryGirl.create(:thing)
end
it "should display a thing with name #{@thing.name} " do
#....
page.should have_css("h1", text: @thing.name)
end
end