summaryrefslogtreecommitdiff
path: root/spec/ruby/core/array/to_h_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/array/to_h_spec.rb')
-rw-r--r--spec/ruby/core/array/to_h_spec.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/ruby/core/array/to_h_spec.rb b/spec/ruby/core/array/to_h_spec.rb
index 27a0b6112f..4431430216 100644
--- a/spec/ruby/core/array/to_h_spec.rb
+++ b/spec/ruby/core/array/to_h_spec.rb
@@ -35,6 +35,10 @@ describe "Array#to_h" do
lambda { [].to_h(:a, :b) }.should raise_error(ArgumentError)
end
+ it "produces a hash that returns nil for a missing element" do
+ [[:a, 1], [:b, 2]].to_h[:c].should be_nil
+ end
+
ruby_version_is "2.6" do
context "with block" do
it "converts [key, value] pairs returned by the block to a Hash" do