fixed bug where accessor methods not properly generating due columns_hash lookup failing on method name as a symbol

force value to time on write unless is a date attribute
This commit is contained in:
Adam Meehan
2008-12-07 11:07:39 +11:00
parent e4760126e2
commit e9fa4ca20a
2 changed files with 22 additions and 4 deletions

View File

@@ -8,6 +8,21 @@ describe ValidatesTimeliness::ActiveRecord::AttributeMethods do
@person = Person.new
end
it "should call write_date_time_attribute when date attribute assigned value" do
@person.should_receive(:write_date_time_attribute)
@person.birth_date = "2000-01-01"
end
it "should call write_date_time_attribute when time attribute assigned value" do
@person.should_receive(:write_date_time_attribute)
@person.birth_time = "12:00"
end
it "should call write_date_time_attribute when datetime attribute assigned value" do
@person.should_receive(:write_date_time_attribute)
@person.birth_date_and_time = "2000-01-01 12:00"
end
it "should call parser on write for datetime attribute" do
@person.class.should_receive(:parse_date_time).once
@person.birth_date_and_time = "2000-01-01 02:03:04"