diff options
Diffstat (limited to 'spec/ruby/core/struct/to_h_spec.rb')
-rw-r--r-- | spec/ruby/core/struct/to_h_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/core/struct/to_h_spec.rb b/spec/ruby/core/struct/to_h_spec.rb index 9239c87988..ddfbfbca61 100644 --- a/spec/ruby/core/struct/to_h_spec.rb +++ b/spec/ruby/core/struct/to_h_spec.rb @@ -12,4 +12,12 @@ describe "Struct#to_h" do car.to_h[:make] = 'Suzuki' car.make.should == 'Ford' end + + ruby_version_is "2.6" do + it "converts [key, value] pairs returned by the block to a hash" do + car = StructClasses::Car.new('Ford', 'Ranger') + h = car.to_h {|k, v| [k.to_s, "#{v}".downcase]} + h.should == {"make" => "ford", "model" => "ranger", "year" => ""} + end + end end |