No has entrat com a usuari. Pots registrar-te o entrar. Així podràs crear entrades o comentar-ne d'altres!
Gravatar
0

Within the rspec context we already have access to a special method "helper" wich we can use like this:

it "should show the price" do
  res = helper.number_to_currency 56
  res.should == "56,00 €"
end

Well, only in the "request" type specs of course. The problem is that this special 'helper' method is not available to our files under the "spec/support" folder. If we want to make use of it from there we have to run our own solution. This is an easy one: Add a new support file with this content:


def helper
  Helper.instance
end

class Helper
  include Singleton
  include ActionView::Helpers::NumberHelper
  # Include the rest of view helpers you need here
end

Tags


0 comentaris