Skip to content

Commit

Permalink
Rephrase the spec descriptions about keyword/positional arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed Jan 8, 2021
1 parent dce93af commit 6037e73
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/rspec/mocks/argument_matchers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -381,22 +381,22 @@ def ==(other)
a_double.random_call(:a => "a", :b => "b")
end

it "matches against a hash submitted by reference and received by value (in both Ruby 2 and Ruby 3)" do
it "matches against a hash submitted as keyword arguments a and received as a positional argument (in both Ruby 2 and Ruby 3)" do
opts = {:a => "a", :b => "b"}
expect(a_double).to receive(:random_call).with(opts)
a_double.random_call(:a => "a", :b => "b")
end

if RUBY_VERSION >= "2.7"
it "fails to match against a hash submitted by value and received by reference in Ruby 2.7 or later", :reset => true do
it "fails to matches against a hash submitted as a positional argument and received as keyword arguments in Ruby 2.7 or later", :reset => true do
opts = {:a => "a", :b => "b"}
expect(a_double).to receive(:random_call).with(:a => "a", :b => "b")
expect do
a_double.random_call(opts)
end.to fail_with(/expected: \(\{(:a=>\"a\", :b=>\"b\"|:b=>\"b\", :a=>\"a\")\}\)/)
end
else
it "matches against a hash submitted by value and received by reference in Ruby 2.6 or before" do
it "matches against a hash submitted as a positional argument and received as keyword arguments in Ruby 2.6 or before" do
opts = {:a => "a", :b => "b"}
expect(a_double).to receive(:random_call).with(:a => "a", :b => "b")
a_double.random_call(opts)
Expand Down

0 comments on commit 6037e73

Please sign in to comment.