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

Stop using RSpec is_expected with block expectations #4870

Merged

Conversation

kennyadsl
Copy link
Member

@kennyadsl kennyadsl commented Jan 24, 2023

Summary

This syntax support is ending and it was printing a number of deprecation messages in our test suite output.

From One-line syntax documentation:

The one-liner syntax only works with non-block expectations
(e.g. expect(obj).to eq, etc) and it cannot be used with block
expectations (e.g. expect { object }).

List of related deprecation warnings removed
Deprecation Warnings:

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 `Spree::Address#state_name` from "A State Name" to nil` not `expect(value).to change `Spree::Address#state_name` from "A State Name" to nil`

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 `Spree::Address#state` from #<Spree::State id: 1311, name: "maryland", abbr: "md", country_id:...at: "2023-01-24 05:57:48.394225000 +0000", created_at: "2023-01-24 05:57:48.394225000 +0000"> to nil` not `expect(value).to change `Spree::Address#state` from #<Spree::State id: 1311, name: "maryland", abbr: "md", country_id:...at: "2023-01-24 05:57:48.394225000 +0000", created_at: "2023-01-24 05:57:48.394225000 +0000"> to nil`

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 `Spree::Address.count` by 1` not `expect(value).to change `Spree::Address.count` by 1`

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 `Spree::Order#last_ip_address` to "127.0.0.1"` not `expect(value).to change `Spree::Order#last_ip_address` to "127.0.0.1"`
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 `Spree::Order#last_ip_address` to "127.0.0.1"` not `expect(value).to change `Spree::Order#last_ip_address` to "127.0.0.1"`
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 `Spree::Order#last_ip_address` to "127.0.0.1"` not `expect(value).to change `Spree::Order#last_ip_address` to "127.0.0.1"`

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 `Spree::UserAddress.count` by 1` not `expect(value).to change `Spree::UserAddress.count` by 1`

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 `[address.state, address.state_name]` from [nil, "maryland"] to [#<Spree::State id: 1317, name..._at: "2023-01-24 05:57:48.428391000 +0000", created_at: "2023-01-24 05:57:48.428391000 +0000">, nil]` not `expect(value).to change `[address.state, address.state_name]` from [nil, "maryland"] to [#<Spree::State id: 1317, name..._at: "2023-01-24 05:57:48.428391000 +0000", created_at: "2023-01-24 05:57:48.428391000 +0000">, nil]`

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 `original_user_address.reload.default` from true` not `expect(value).to change `original_user_address.reload.default` from true`

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 `original_user_address.reload.default`` not `expect(value).to change `original_user_address.reload.default``

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 `original_user_bill_address.reload.default_billing` from true to false` not `expect(value).to change `original_user_bill_address.reload.default_billing` from true to false`

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 `original_user_bill_address.reload.default_billing`` not `expect(value).to change `original_user_bill_address.reload.default_billing``

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 `taxon2.reload.permalink` from "t/t2" to "t/foo"` not `expect(value).to change `taxon2.reload.permalink` from "t/t2" to "t/foo"`
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 `taxon2.reload.permalink` from "t/t2" to "t/foo"` not `expect(value).to change `taxon2.reload.permalink` from "t/t2" to "t/foo"`

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 `taxon2.reload.permalink` from "t/t2" to "t/special-characters"` not `expect(value).to change `taxon2.reload.permalink` from "t/t2" to "t/special-characters"`

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 `taxon2.reload.permalink` from "t/t2" to "t/t1/foo"` not `expect(value).to change `taxon2.reload.permalink` from "t/t2" to "t/t1/foo"`

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 `taxon2.reload.permalink` from "t/t2" to "t/t1/t2"` not `expect(value).to change `taxon2.reload.permalink` from "t/t2" to "t/t1/t2"`

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 `taxon2_child.reload.permalink` from "t/t2/t2_child" to "t/foo/t2_child"` not `expect(value).to change `taxon2_child.reload.permalink` from "t/t2/t2_child" to "t/foo/t2_child"`
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 `taxon2_child.reload.permalink` from "t/t2/t2_child" to "t/foo/t2_child"` not `expect(value).to change `taxon2_child.reload.permalink` from "t/t2/t2_child" to "t/foo/t2_child"`

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 `taxon2_child.reload.permalink` from "t/t2/t2_child" to "t/special-characters/t2_child"` not `expect(value).to change `taxon2_child.reload.permalink` from "t/t2/t2_child" to "t/special-characters/t2_child"`

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 `taxon2_child.reload.permalink` from "t/t2/t2_child" to "t/t1/foo/t2_child"` not `expect(value).to change `taxon2_child.reload.permalink` from "t/t2/t2_child" to "t/t1/foo/t2_child"`

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 `taxon2_child.reload.permalink` from "t/t2/t2_child" to "t/t1/t2/t2_child"` not `expect(value).to change `taxon2_child.reload.permalink` from "t/t2/t2_child" to "t/t1/t2/t2_child"`

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 `user.reload.addresses.count` by 1` not `expect(value).to change `user.reload.addresses.count` by 1`

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 raise ActiveRecord::RecordInvalid` not `expect(value).to raise ActiveRecord::RecordInvalid`

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 raise StateMachines::InvalidTransition with message matching /We are unable to calculate shipping rates for the selected items./` not `expect(value).to raise StateMachines::InvalidTransition with message matching /We are unable to calculate shipping rates for the selected items./`

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

  • I have written a thorough PR description.
  • I have kept my commits small and atomic.
  • I have used clear, explanatory commit messages.

The following are not always needed (cross them out if they are not):

  • I have added automated tests to cover my changes.
  • I have attached screenshots to demo visual changes.
  • I have opened a PR to update the guides.
  • I have updated the README to account for my changes.

@kennyadsl kennyadsl added type:enhancement Proposed or newly added feature changelog:solidus_core Changes to the solidus_core gem labels Jan 24, 2023
@kennyadsl kennyadsl requested a review from a team as a code owner January 24, 2023 09:05
@kennyadsl kennyadsl self-assigned this Jan 24, 2023
This syntax support is ending and it was printing a number
of deprecation messages in our test suite output.

From One-line syntax documentation [1]:

> The one-liner syntax only works with non-block expectations
> (e.g. expect(obj).to eq, etc) and it cannot be used with block
> expectations (e.g. expect { object }).

[1]: https://relishapp.com/rspec/rspec-core/docs/subject/one-liner-syntax
@kennyadsl kennyadsl force-pushed the kennyadsl/remove-deprecation-tests branch from 443be2d to a009fc7 Compare January 24, 2023 11:24
@waiting-for-dev waiting-for-dev merged commit 0b4085b into solidusio:master Jan 25, 2023
@waiting-for-dev waiting-for-dev deleted the kennyadsl/remove-deprecation-tests branch January 25, 2023 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_core Changes to the solidus_core gem type:enhancement Proposed or newly added feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants