mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-27 17:28:26 -04:00
Merge pull request #164 from Skud/blankplantingtime
Fixed bug where blank planting date didn't work
This commit is contained in:
commit
5431cdcd71
2 files changed
+6
-1
No files matched your search
@@ -42,6 +42,6 @@ class Planting < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def planted_at_string=(str)
|
||||
self.planted_at = Time.parse(str)
|
||||
self.planted_at = str == '' ? nil : Time.parse(str)
|
||||
end
|
||||
end
|
||||
@@ -39,6 +39,11 @@ describe Planting do
|
||||
@planting.planted_at.should == Time.local(2013, 03, 01)
|
||||
end
|
||||
|
||||
it 'should accept blank dates' do
|
||||
@planting.planted_at_string = ''
|
||||
@planting.planted_at.should == nil
|
||||
end
|
||||
|
||||
it "should output dates in ISO format" do
|
||||
@planting.planted_at = Time.local(2013, 03, 01)
|
||||
@planting.planted_at_string.should == "2013-03-01"
|
||||
|
||||
Reference in new issue
Block a user