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
Родитель a093c98ddc
Коммит 00f7e42451
1 изменённых файлов: 20 добавлений и 7 удалений

Просмотреть файл

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