Commit 01974185 authored by Robert Speicher's avatar Robert Speicher

Simplify is_within matcher

[ci skip]
parent bf625b7c
...@@ -73,11 +73,7 @@ module Shoulda::Matchers::ActiveModel ...@@ -73,11 +73,7 @@ module Shoulda::Matchers::ActiveModel
class EnsureLengthOfMatcher class EnsureLengthOfMatcher
# Shortcut for is_at_least and is_at_most # Shortcut for is_at_least and is_at_most
def is_within(range) def is_within(range)
if range.exclude_end? is_at_least(range.min) && is_at_most(range.max)
is_at_least(range.first) && is_at_most(range.last - 1)
else
is_at_least(range.first) && is_at_most(range.last)
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment