diff options
Diffstat (limited to 'test/ostruct')
-rw-r--r-- | test/ostruct/test_ostruct.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb index 491f950838..d82bab9784 100644 --- a/test/ostruct/test_ostruct.rb +++ b/test/ostruct/test_ostruct.rb @@ -70,14 +70,19 @@ class TC_OpenStruct < Test::Unit::TestCase assert_equal(a, 'a') end - def test_method_missing_handles_square_bracket_equals - o = OpenStruct.new - assert_raise(NoMethodError) { o[:foo] = :bar } + def test_setter + os = OpenStruct.new + os[:foo] = :bar + assert_equal :bar, os.foo + os['foo'] = :baz + assert_equal :baz, os.foo end - def test_method_missing_handles_square_brackets - o = OpenStruct.new - assert_raise(NoMethodError) { o[:foo] } + def test_getter + os = OpenStruct.new + os.foo = :bar + assert_equal :bar, os[:foo] + assert_equal :bar, os['foo'] end def test_to_h |