You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, beginless and endless ranges are not correctly handled by .in_range on top of validates_inclusion_of, even though ActiveRecord properly handles beginless and endless ranges.
An error is raised instead of correctly asserting the validation:
Failure/Error: it { is_expected.to validate_inclusion_of(:created_on).in_range(..Date.yesterday) }
RangeError:
cannot get the first element of beginless range
A similar issue is raised for endless ranges:
RangeError:
cannot get the maximum of endless range
Description
Currently, beginless and endless ranges are not correctly handled by
.in_range
on top ofvalidates_inclusion_of
, even though ActiveRecord properly handles beginless and endless ranges.Reproduction Steps
Given a sample model:
And the respective spec:
An error is raised instead of correctly asserting the validation:
A similar issue is raised for endless ranges:
System configuration
shoulda_matchers version: 6.1.0
rails version: 7.1.3
ruby version: 3.2.2
The text was updated successfully, but these errors were encountered: