1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

spec/ruby/core/hash/constructor_spec.rb: add "ruby_version_is" guard

follow up for d3f1c615c5
This commit is contained in:
Yusuke Endoh 2019-05-23 01:46:21 +09:00
parent a093c98ddc
commit 00f7e42451

View file

@ -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