diff options
Diffstat (limited to 'spec/ruby/core/env/to_h_spec.rb')
-rw-r--r-- | spec/ruby/core/env/to_h_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/core/env/to_h_spec.rb b/spec/ruby/core/env/to_h_spec.rb index f7f4314335..f6c796b4d6 100644 --- a/spec/ruby/core/env/to_h_spec.rb +++ b/spec/ruby/core/env/to_h_spec.rb @@ -3,4 +3,17 @@ require_relative 'shared/to_hash' describe "ENV.to_hash" do it_behaves_like :env_to_hash, :to_h + + ruby_version_is "2.6" do + it "converts [key, value] pairs returned by the block to a hash" do + orig = ENV.to_hash + begin + ENV.replace "a" => "b", "c" => "d" + i = 0 + ENV.to_h {|k, v| [k.to_sym, v.upcase]}.should == {a:"B", c:"D"} + ensure + ENV.replace orig + end + end + end end |