-
-
Notifications
You must be signed in to change notification settings - Fork 910
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix numericality matcher w/ numeric columns
Fix the matcher so it still raises a CouldNotSetAttributeError against a numeric column, but only if the matcher has not been qualified at all. When the matcher is qualified with anything else, then it's okay to use a numeric column, as long as the matcher no longer asserts that the record disallows a non-numeric value.
- Loading branch information
Showing
12 changed files
with
383 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
18b2859
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were the changes made here (validates_numericality_of) meant to still support an attr_accessor on an ActiveRecord model that has a numerical validation? I see a test for an ActiveModel and ActiveRecord driven classes but not specifically ActiveRecord with a validated attr_accessor (a non db backed column). This was supported on shoulda-matchers 2.x but fails now on 3.0 because when looking up
subject.class.columns_hash[].type
(the column_type private method) its nil since field isn't a db backed column, its a simple attr_accessor.18b2859
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, an
attr_accessor
on an ActiveRecord was never supported, since it turns out that wasn't tested. However, see #822 where this is being added.18b2859
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcmire awesome thanks for clarifying! I'll follow that issue.