thoughtbot / shoulda-matchers

Simple one-liner tests for common Rails functionality
https://matchers.shoulda.io
MIT License
3.51k stars 912 forks source link

v4.4.0 introduces undefined method errors #1333

Closed sandro-aboutsource closed 4 years ago

sandro-aboutsource commented 4 years ago

After upgrading to version 4.4.0 we see errors like

     NoMethodError: undefined method `validate_length_of' for #<RSpec::ExampleGroups::Foo

in many projects. It is the same in Rails and non Rails projects.

As I see some similar issues (#1332 and #1331) it might be a general problem. Maybe it has to do with https://github.com/thoughtbot/shoulda-matchers/pull/1320?

vsppedro commented 4 years ago

Thanks for sharing this!

I'll take a look ASAP.

@mcmire, I'd like to have a question cleared up, please.

I'm wondering if I should revert the changes made by the #1320 or if I should create tests to replicate the problem and then fix without removing the autoloading.

What are your thoughts on this?

mcmire commented 4 years ago

@VSPPedro I think for now let's just revert the commit. I took some time this morning to look into why it was that the test suite passed yet this issue occurred, and the problem is that we aren't exercising ALL of the matchers in the integration tests (we never have been, I guess). We do test a lot more of the matchers in the tests for Shoulda, so it wouldn't be terribly difficult to copy this over and then add anything else that might be missing. However, I don't want to hold people up from taking advantage of this release, so for now let's revert.

mcmire commented 4 years ago

Fixed in v4.4.1!