summaryrefslogtreecommitdiff
path: root/test/ostruct/test_ostruct.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ostruct/test_ostruct.rb')
-rw-r--r--test/ostruct/test_ostruct.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index 491f950..d82bab9 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