mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-18 21:56:55 -04:00
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.
16 lines
403 B
Ruby
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
|