Files
growstuff/spec/helpers/application_helper.rb
Skud 2ecbd8315d bugfix: don't say 'not yet set' in planting form
PT: https://www.pivotaltracker.com/story/show/51457917

Maco found this. The problem was that if you had a blank planting date,
and then re-edited the planting, it would say "not yet set" in the form
field, then die when it later tried to convert that to a date.

I replaced Miles's planted_at_string stuff in the model with a simpler
parse_date method in the application helper.
2013-06-11 16:08:02 +10:00

16 lines
403 B
Ruby

require 'spec_helper'
describe ApplicationHelper do
it "formats prices" do
price_in_dollars(999).should eq '9.99'
price_with_currency(999).should eq '9.99 AUD'
end
it "parses dates" do
parse_date(nil).should eq nil
parse_date('').should eq nil
parse_date('2012-05-12').should eq Date.new(2012, 5, 12)
parse_date('may 12th 2012').should eq Date.new(2012, 5, 12)
end
end