Skip to content

Commit

Permalink
Suppress a deprecation warning when using Ruby 2.7.0-dev
Browse files Browse the repository at this point in the history
This PR suppresses the following deprecation warning when using Ruby 2.7.0-dev.

```console
% ruby -v
ruby 2.7.0dev (2019-12-23T02:48:54Z master 048f797bf0) [x86_64-darwin17]

% bundle exec rake

(snip)

/Users/koic/.rbenv/versions/2.7.0-dev/lib/ruby/gems/2.7.0/gems/rspec-core-3.9.0/lib/rspec/core/shared_example_group.rb:36:
warning: The last argument is used as keyword parameters; maybe **
should be added to the call
/Users/koic/src/github.com/rubocop-hq/rubocop/spec/rubocop/cop/style/numeric_predicate_spec.rb:12:
warning: The called method is defined here
```

https://bugs.ruby-lang.org/issues/14183
  • Loading branch information
koic authored and bbatsov committed Dec 23, 2019
1 parent 3bcfb93 commit 46e412e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spec/rubocop/cop/style/numeric_predicate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

shared_examples(
'code with offense'
) do |code, expected:, use: expected, instead_of: code|
) do |code, options|
context "when checking #{code}" do
let(:source) { code }
let(:use) { options[:use] || options[:expected] }
let(:instead_of) { options[:instead_of] || code }

let(:message) { "Use `#{use}` instead of `#{instead_of}`." }

Expand All @@ -20,7 +22,7 @@
expect(cop.messages).to eq([message])
end

if expected
if (expected = options[:expected])
it 'auto-corrects' do
expect(autocorrect_source(code)).to eq(expected)
end
Expand Down

0 comments on commit 46e412e

Please sign in to comment.