summaryrefslogtreecommitdiff
path: root/test/ostruct
diff options
context:
space:
mode:
Diffstat (limited to 'test/ostruct')
-rw-r--r--test/ostruct/test_ostruct.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index 1826e40..9b125fc 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -85,4 +85,11 @@ class TC_OpenStruct < Test::Unit::TestCase
assert_equal(h, OpenStruct.new("name" => "John Smith", "age" => 70, pension: 300).to_h)
end
+
+ def test_each_pair
+ h = {name: "John Smith", age: 70, pension: 300}
+ os = OpenStruct.new(h)
+ assert_equal '#<Enumerator: #<OpenStruct name="John Smith", age=70, pension=300>:each_pair>', os.each_pair.inspect
+ assert_equal [[:name, "John Smith"], [:age, 70], [:pension, 300]], os.each_pair.to_a
+ end
end