diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-05-23 01:46:21 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-05-23 01:46:21 +0900 |
commit | 00f7e424516a6c5ea58ddb3cc821d3cabe9c496c (patch) | |
tree | 5ec0f26aaa0676137ea016f8ad34a79af5d9fac0 /spec/ruby/core | |
parent | a093c98ddc92d8b0a341233630aea8f778188c7e (diff) | |
download | ruby-00f7e424516a6c5ea58ddb3cc821d3cabe9c496c.tar.gz |
spec/ruby/core/hash/constructor_spec.rb: add "ruby_version_is" guard
follow up for d3f1c615c5
Diffstat (limited to 'spec/ruby/core')
-rw-r--r-- | spec/ruby/core/hash/constructor_spec.rb | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/spec/ruby/core/hash/constructor_spec.rb b/spec/ruby/core/hash/constructor_spec.rb index 4e02a955bd..d32117b5a1 100644 --- a/spec/ruby/core/hash/constructor_spec.rb +++ b/spec/ruby/core/hash/constructor_spec.rb @@ -42,13 +42,26 @@ describe "Hash.[]" do 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 |