Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Keyword argument warning on Ruby 2.7 for #and_call_original #1306

Closed
@jaynetics

Description

@jaynetics

Subject of the issue

#and_call_original with keyword arguments causes the following warning:

~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/message_expectation.rb:101: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call

Your environment

  • Ruby version: 2.7.0
  • rspec-expectations version: 3.9.0

Steps to reproduce

require 'rspec'

class Foo
  def initialize(bar: nil); end
end

RSpec.describe Foo do
  it 'works' do
    expect(Foo).to receive(:new).with(bar: :qux).and_call_original
    Foo.new(bar: :qux)
  end
end

RSpec::ExampleGroups::Foo.run

Expected behavior

No warning is emitted.

Actual behavior

A warning is emitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions