提交 4db4f8c6 编写于 作者: B Ben Orenstein 提交者: Santiago Pastorino

Add tests for InheritableOptions.

[#6625 state:committed]
Signed-off-by: NSantiago Pastorino <santiago@wyeworks.com>
上级 443af589
......@@ -50,4 +50,30 @@ def test_method_access
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册