Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress RSspec deprecation warnings #1631

Merged
merged 3 commits into from
Apr 27, 2022
Merged

Conversation

mishina2228
Copy link
Member

@mishina2228 mishina2228 commented Apr 25, 2022

Description

This PR suppresses the following RSpec deprecation warnings.

  • Pass a block instead of a lambda to expect

    The implicit block expectation syntax is deprecated, you should pass a block rather than an argument to `expect` to use the provided block expectation matcher or the matcher must implement `supports_value_expectations?`. e.g  `expect { value }.to change `step_args.first`` not `expect(value).to change `step_args.first``
    
  • Replace deprecated should with RSpec3's expect

    DEPRECATION: Using `should` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }` instead. Called from /Users/runner/work/cucumber-ruby/cucumber-ruby/examples/i18n/sv/features/step_definitions/kalkulator_steps.rb:27:in `block in <top (required)>'.
    

Type of change

  • Refactoring (improvements to code design or tooling that don't change behaviour)

Checklist:

  • Tests have been added for any changes to behaviour of the code
  • New and existing tests are passing locally and on CI
  • bundle exec rubocop reports no offenses
  • RDoc comments have been updated
  • CHANGELOG.md has been updated

This change suppresses the following deprecation warning:

```
The implicit block expectation syntax is deprecated, you should pass a block rather than an argument to `expect` to use the provided block expectation matcher or the matcher must implement `supports_value_expectations?`. e.g  `expect { value }.to change `step_args.first`` not `expect(value).to change `step_args.first``
```
@mishina2228 mishina2228 marked this pull request as ready for review April 25, 2022 15:01
Copy link
Contributor

@luke-hill luke-hill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick query, rest seems ok

@@ -24,5 +24,5 @@
end

Then(/il risultato deve essere (\d*)/) do |result|
@result.should == result.to_i
expect(@result).to eq(result.to_f)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you've altered these from integers to floats?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied it from other calculator_steps.rb for consistency.
e.g.

Then(/the result should be (.*) on the screen/) do |result|
expect(@result).to eq(result.to_f)
end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I looked at each of the features carefully, and it seems that they are expecting an Integer, not a Float.
I will fix them. Thank you for pointing them out!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mishina2228 👍

This change suppresses the following deprecation warning:

```
DEPRECATION: Using `should` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }` instead. Called from /Users/runner/work/cucumber-ruby/cucumber-ruby/examples/i18n/sv/features/step_definitions/kalkulator_steps.rb:27:in `block in <top (required)>'.
```
@luke-hill luke-hill merged commit 969ca77 into main Apr 27, 2022
@luke-hill luke-hill deleted the fix-rspec-deprecation-warnings branch April 27, 2022 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants