-
-
Notifications
You must be signed in to change notification settings - Fork 359
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
Rails 7.1 breaks receive().with #1530
Comments
Why does |
Even then, why would it not redefine existing methods? I'll git blame to see if I can find the reason for this. |
Ah, I think the intent is to not redefine methods directly defined in |
Fix: rspec#1530 My understanding of this `next if method_defined?` check that there since this class was added in 08ec2e8 is that it's to prevent accidentally overriding Matcher or own methods. If my understanding is correct, then we should ignore methods inherited from `Object`.
I think I have a fix for it, but GitHub seems to be having issues, I get an error message when trying to create the PR....
https:/rspec/rspec-mocks/compare/rspec:main...casperisfine:receiver-with?expand=1 |
@byroot I’ve opened one, does it work for you? |
Sure, thank you. |
rspec to fix Object#with - rspec/rspec-mocks#1530 database_cleaner to fix "undefined method `table_name' for ActiveRecord::SchemaMigration:Class"
Fixes test failures with Rails 7.1 rspec/rspec-mocks#1530
We ran bundle update --conservative rspec-mocks We need to update rspec-mocks here since Rails 7.1 introduces a method `with` that clashes with the `with` method provided by rspec-mocks[1]. We're using the latter in the corp_middleware_spec. [1] rspec/rspec-mocks#1530 Co-authored-by: Chris Roos <[email protected]>
We ran bundle update --conservative rspec-mocks We need to update rspec-mocks here since Rails 7.1 introduces a method `with` that clashes with the `with` method provided by rspec-mocks[1]. We're using the latter in the corp_middleware_spec. [1] rspec/rspec-mocks#1530 Co-authored-by: Chris Roos <[email protected]>
We ran bundle update --conservative rspec-mocks We need to update rspec-mocks here since Rails 7.1 introduces a method `with` that clashes with the `with` method provided by rspec-mocks[1]. We're using the latter in the corp_middleware_spec. [1] rspec/rspec-mocks#1530 Co-authored-by: Chris Roos <[email protected]>
rspec to fix Object#with - rspec/rspec-mocks#1530 database_cleaner to fix "undefined method `table_name' for ActiveRecord::SchemaMigration:Class"
rspec to fix Object#with - rspec/rspec-mocks#1530 database_cleaner to fix "undefined method `table_name' for ActiveRecord::SchemaMigration:Class"
Your environment
Steps to reproduce
In a Rails application (i.e., with Rails loaded), define a method expectation:
Expected behavior
Pass.
Actual behavior
What happened?
Rails monkey-patched
Object#with
rails/rails#46681 /cc @byrootRSpec
receive
matcher defines chain methods only for undefined methods:rspec-mocks/lib/rspec/mocks/matchers/receive.rb
Lines 58 to 59 in 4a1032b
Since
#with
is defined onObject
, thewith
modifier is no longer available.The text was updated successfully, but these errors were encountered: