ruby-changes:55789
From: Yusuke <ko1@a...>
Date: Thu, 23 May 2019 01:47:16 +0900 (JST)
Subject: [ruby-changes:55789] Yusuke Endoh: 00f7e42451 (trunk): spec/ruby/core/hash/constructor_spec.rb: add "ruby_version_is" guard
https://git.ruby-lang.org/ruby.git/commit/?id=00f7e42451 From 00f7e424516a6c5ea58ddb3cc821d3cabe9c496c Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Thu, 23 May 2019 01:46:21 +0900 Subject: spec/ruby/core/hash/constructor_spec.rb: add "ruby_version_is" guard follow up for d3f1c615c5 diff --git a/spec/ruby/core/hash/constructor_spec.rb b/spec/ruby/core/hash/constructor_spec.rb index 4e02a95..d32117b 100644 --- a/spec/ruby/core/hash/constructor_spec.rb +++ b/spec/ruby/core/hash/constructor_spec.rb @@ -42,13 +42,26 @@ describe "Hash.[]" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/hash/constructor_spec.rb#L42 Hash[ary].should == { a: :b } end - it "ignores elements that are not arrays" do - -> { - Hash[[:a]].should == {} - }.should raise_error(ArgumentError) - -> { - Hash[[:nil]].should == {} - }.should raise_error(ArgumentError) + ruby_version_is "" ... "2.7" do + it "ignores elements that are not arrays" do + -> { + Hash[[:a]].should == {} + }.should complain(/ignoring wrong elements/) + -> { + Hash[[:nil]].should == {} + }.should complain(/ignoring wrong elements/) + end + end + + ruby_version_is "2.7" do + it "ignores elements that are not arrays" do + -> { + Hash[[:a]].should == {} + }.should raise_error(ArgumentError) + -> { + Hash[[:nil]].should == {} + }.should raise_error(ArgumentError) + end end it "raises an ArgumentError for arrays of more than 2 elements" do -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/