jdliss / shoulda-callback-matchers

Test existence of your Rails callbacks without having to call them
MIT License
134 stars 18 forks source link

Wrong number of arguments when upgrading to Rails 5.2 #26

Open zaidhuda opened 6 years ago

zaidhuda commented 6 years ago

Upgrading from Rails 5.1.5 to 5.2.0 results in

ArgumentError: wrong number of arguments (given 1, expected 0)

for

callback(:after_commit_callback).after(:commit).on(:create)

rubendinho commented 6 years ago

+1

Zethir commented 5 years ago

Same problem here !

guingois commented 5 years ago

Looks like the issue comes from the following PR: https://github.com/rails/rails/pull/30945

More precisely:

Those changes look incompatible with calling a condition with an argument: https://github.com/jdliss/shoulda-callback-matchers/blob/b8a3680bc1d19ac713e43054a2b33238ce845698/lib/shoulda/callback/matchers/active_model.rb#L208

From my understanding, this is a "bug" on Rails side, since the mentioned PR introduces conditions that cannot be called with an argument and that change doesn't look related to the PR goal.

That said, I've only done a quick check of the two codebases, and shoulda-callback-matchers digs rather deep in a complex and private Rails API, so I might be mistaken here.

kinnalru commented 5 years ago

+1 rails 5.2.2

moliver-hemasystems commented 5 years ago

It looks like there was a commit a while back on a fork to work around this issue. Is that worthwhile to include? Or since it sounds like it's considered an issue with Rails, is there an issue over there I can signal boost?

Blaze34 commented 4 years ago

Same issue. Rails 6.0.0, 6.0.1

thoraxe commented 2 years ago

+1 -- is there an expected fix for this?