diff options
Diffstat (limited to 'test/ostruct')
-rw-r--r-- | test/ostruct/test_ostruct.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb index 14bc2b2da8..2e8fc7bf58 100644 --- a/test/ostruct/test_ostruct.rb +++ b/test/ostruct/test_ostruct.rb @@ -9,6 +9,19 @@ class TC_OpenStruct < Test::Unit::TestCase assert_equal h, OpenStruct.new(Struct.new(*h.keys).new(*h.values)).to_h end + def test_respond_to + o = OpenStruct.new + o.a = 1 + assert_respond_to(o, :a) + assert_respond_to(o, :a=) + end + + def test_respond_to_with_lazy_getter + o = OpenStruct.new a: 1 + assert_respond_to(o, :a) + assert_respond_to(o, :a=) + end + def test_equality o1 = OpenStruct.new o2 = OpenStruct.new |