summaryrefslogtreecommitdiff
path: root/spec/support/matchers/is_within.rb
blob: 0c35fc7e899b71e01613aaa2dd04427280773107 (plain)
1
2
3
4
5
6
7
8
9
# Extend shoulda-matchers
module Shoulda::Matchers::ActiveModel
  class ValidateLengthOfMatcher
    # Shortcut for is_at_least and is_at_most
    def is_within(range)
      is_at_least(range.min) && is_at_most(range.max)
    end
  end
end