diff options
author | Ben Orenstein <ben.orenstein@gmail.com> | 2011-03-25 15:48:52 -0400 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-04-13 23:30:58 -0300 |
commit | 4db4f8c6244f017def5668d44a62bdad231f4c18 (patch) | |
tree | b85a38efecc787a1e6e1af6d1502854ccb346d17 /activesupport | |
parent | 443af589952f88a72074e3256688a23ef901ae89 (diff) | |
download | rails-4db4f8c6244f017def5668d44a62bdad231f4c18.tar.gz rails-4db4f8c6244f017def5668d44a62bdad231f4c18.tar.bz2 rails-4db4f8c6244f017def5668d44a62bdad231f4c18.zip |
Add tests for InheritableOptions.
[#6625 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/test/ordered_options_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/activesupport/test/ordered_options_test.rb b/activesupport/test/ordered_options_test.rb index e48425ca25..b215b60df3 100644 --- a/activesupport/test/ordered_options_test.rb +++ b/activesupport/test/ordered_options_test.rb @@ -50,4 +50,30 @@ class OrderedOptionsTest < Test::Unit::TestCase assert_equal 2, a.size assert_equal 56, a.else_where end + + def test_inheritable_options_continues_lookup_in_parent + parent = ActiveSupport::OrderedOptions.new + parent[:foo] = true + + child = ActiveSupport::InheritableOptions.new(parent) + assert child.foo + end + + def test_inheritable_options_can_override_parent + parent = ActiveSupport::OrderedOptions.new + parent[:foo] = :bar + + child = ActiveSupport::InheritableOptions.new(parent) + child[:foo] = :baz + + assert_equal :baz, child.foo + end + + def test_inheritable_options_inheritable_copy + original = ActiveSupport::InheritableOptions.new + copy = original.inheritable_copy + + assert copy.kind_of?(original.class) + assert_not_equal copy.object_id, original.object_id + end end |