fix last refactor so it casts Date object to time if attribute is datetime or time with spec added

This commit is contained in:
Adam Meehan
2009-03-05 19:56:38 +11:00
parent 497a97e0b0
commit 1dbac5190b
2 changed files with 6 additions and 1 deletions

View File

@@ -69,6 +69,11 @@ describe ValidatesTimeliness::ActiveRecord::AttributeMethods do
@person.birth_date_and_time.should be_kind_of(Time)
end
it "should return Time object for datetime attribute read method when assigned Date object" do
@person.birth_date_and_time = Date.today
@person.birth_date_and_time.should be_kind_of(Time)
end
it "should return Time object for datetime attribute read method when assigned string" do
@person.birth_date_and_time = "2000-01-01 02:03:04"
@person.birth_date_and_time.should be_kind_of(Time)