FooBarWidget/default_value_for — Issue #20: Subclassing issues
Author: jrafanie
Created: 2011-10-10 19:47:22+00:00
State: open

1) Overriding default_values in a subclass are modifying the parent class. The following fails on the last assert_equal because the subclass is modifying the parent class' value.

```Ruby
define_model_class("TestSuperClass") do
default_value_for :number, 1234
end
define_model_class("TestClass", "TestSuperClass") do
default_value_for :number, 5678
end

object = TestClass.new
assert_equal 5678, object.number

object = TestSuperClass.new
assert_equal 1234, object.number
```

2) New default_values in a subclass are being added to the parent class. The following fails because TestSuperClass.new tries to call .hello=, which doesn't exist.

```Ruby
define_model_class("TestSuperClass") do
default_value_for :number, 1234
end
define_model_class("TestClass", "TestSuperClass") do
default_value_for :hello, "hi"
attr_accessor :hello
end

assert_nothing_raised { TestSuperClass.new }
```