summaryrefslogtreecommitdiff
path: root/spec/support/matchers/is_within.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/matchers/is_within.rb')
-rw-r--r--spec/support/matchers/is_within.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/support/matchers/is_within.rb b/spec/support/matchers/is_within.rb
new file mode 100644
index 00000000000..0c35fc7e899
--- /dev/null
+++ b/spec/support/matchers/is_within.rb
@@ -0,0 +1,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