fix bug preventing custom class methods on date/times

This commit is contained in:
Adam Meehan
2010-03-19 14:11:13 +11:00
parent e9eb812c9e
commit b356363791
2 changed files with 26 additions and 4 deletions

View File

@@ -137,4 +137,21 @@ describe ValidatesTimeliness::ActiveRecord::AttributeMethods do
person.birth_date.should == tomorrow
end
describe "attribute writer" do
it "should be able to be overridden in class" do
Person.class_eval { attr_accessor :birth_date }
person = Person.new
person.birth_date = 'overriden'
person.birth_date.should == 'overriden'
end
after do
Person.class_eval do
undef_method(:birth_date)
undef_method(:birth_date=)
end
end
end
end