I have a step definition:
Then(/^I should see the total price of the products$/) do
# assumes all existing products are in the cart
total = Product.find(:all).inject { |sum, p| sum + p.price }
page.find(".total").should have_content number_to_currency(total)
end
This blows up with undefined method 'number_to_currency' for #<Cucumber::Rails::World:0xbef8d18> (NoMethodError)
I could emulate the "total" by emulating the behaviour of the number_to_currency
helper, but I'd rather re-use the helper from Rails, because in this step I am not interested in the formatting, just that the total is calculated and rendered.
How do I include the NumberHelper or any view helper in capybara for access from step definitions?