-
-
Notifications
You must be signed in to change notification settings - Fork 909
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
Monkey patch to allow use of validation_scopes #779
Comments
Sorry for the late reply on this. While generally I don't like overriding core ActiveRecord methods, I don't see this as particularly egregious, since this is only relegated to the tests, and only done on demand. Ideally, the matchers would expose some kind of option that would let you override the strategy for validating records and checking whether they're valid, but this would require some refactoring all over the place, so I'm not sure that's worth it. |
So I don't think this is something we can change in shoulda-matchers, but using that monkey patch in your own tests seems reasonable to me. |
OK cool :) I can make this into a wiki page if you like? 2015-09-23 23:45 GMT+01:00 Elliot Winkler [email protected]:
|
@samstickland Sure! I just created a wiki and added a section to the home page. Create a new page that mentions this and then add it to the home page. |
Done! 2015-09-24 15:31 GMT+01:00 Elliot Winkler [email protected]:
|
Hi,
We use https://github.com/gtd/validation_scopes quite heavily and it would be useful to be able to use these matchers on the validation scopes it generates.
I initially thought that it might require quite some work, but I eventually settled on this which seems to do the job:
Here's an example. Say we want to test the validation in this ActiveRecord object
The test case would look like this:
Can anyone see any downsides with this approach?
The text was updated successfully, but these errors were encountered: