Fix some spec breakage on 2.7 related to keyword arguments

These specs were probably added in the commit to fully
separate keyword arguments after the release of 2.7.0, but
apparently not tested on 2.7 before hand. The enclosing
ruby_version guard for these specs limits them to 2.7.
This commit is contained in:
Jeremy Evans 2020-01-28 09:26:02 -08:00
Родитель fe8573f31a
Коммит 766f8a7a60
1 изменённых файлов: 21 добавлений и 11 удалений

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

@ -1363,7 +1363,9 @@ describe "A method" do
h = mock("keyword splat")
h.should_receive(:to_hash).and_return({a: 1})
m(h).should == {}
suppress_keyword_warning do
m(h).should == {a: 1}
end
end
evaluate <<-ruby do
@ -1375,28 +1377,34 @@ describe "A method" do
m(a: 1).should == [nil, {a: 1}]
m("a" => 1, a: 1).should == [nil, {"a" => 1, a: 1}]
m({ "a" => 1 }, a: 1).should == [{"a" => 1}, {a: 1}]
->{m({a: 1}, {})}.should raise_error(ArgumentError)
suppress_keyword_warning do
m({a: 1}, {}).should == [{a: 1}, {}]
end
h = {"a" => 1, b: 2}
m(h).should == [{"a" => 1, b: 2}, {}]
suppress_keyword_warning do
m(h).should == [{"a" => 1}, {b: 2}]
end
h.should == {"a" => 1, b: 2}
h = {"a" => 1}
m(h).first.should == h
h = {}
r = m(h)
r.first.should == {}
r.last.should == {}
suppress_keyword_warning do
m(h).should == [nil, {}]
end
hh = {}
h = mock("keyword splat empty hash")
h.should_not_receive(:to_hash)
m(h).should == [{}, {}]
h.should_receive(:to_hash).and_return({a: 1})
suppress_keyword_warning do
m(h).should == [nil, {a: 1}]
end
h = mock("keyword splat")
h.should_not_receive(:to_hash)
m(h).should == [{"a" => 1, a: 2}, {}]
h.should_receive(:to_hash).and_return({"a" => 1})
m(h).should == [h, {}]
end
evaluate <<-ruby do
@ -1412,7 +1420,9 @@ describe "A method" do
m(a: 1).should == [[], {a: 1}]
m("a" => 1, a: 1).should == [[], {"a" => 1, a: 1}]
m({ "a" => 1 }, a: 1).should == [[{"a" => 1}], {a: 1}]
m({a: 1}, {}).should == [[{a: 1}, {}], {}]
suppress_keyword_warning do
m({a: 1}, {}).should == [[{a: 1}], {}]
end
m({a: 1}, {"a" => 1}).should == [[{a: 1}, {"a" => 1}], {}]
bo = BasicObject.new