fixed error on database write with saving cached values for time attributes which have been converted

This commit is contained in:
Adam Meehan
2008-06-30 16:30:13 +10:00
parent ed23c4a9a4
commit 39e16d2fde
2 changed files with 11 additions and 21 deletions

View File

@@ -69,8 +69,7 @@ describe ValidatesTimeliness::AttributeMethods do
Time.zone = 'Melbourne'
time_string = "2000-06-01 01:02:03"
@person.birth_date_and_time = time_string
@person.birth_date_and_time.utc_offset.should == 10.hours
@person.birth_date_and_time.strftime('%Y-%m-%d %H:%M:%S').should == time_string
@person.birth_date_and_time.strftime('%Y-%m-%d %H:%M:%S %Z %z').should == time_string + ' EST +1000'
end
it "should return time object from database in correct timezone" do
@@ -80,8 +79,9 @@ describe ValidatesTimeliness::AttributeMethods do
@person.birth_date_and_time = time_string
@person.save
@person.reload
@person.birth_date_and_time.to_s(:db).should == time_string
@person.birth_date_and_time.strftime('%Y-%m-%d %H:%M:%S %Z %z').should == time_string + ' EST +1000'
end
end
it "should return same time object on repeat reads" do