1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00

Use all?.

This commit is contained in:
Gabe Berke-Williams 2012-09-28 10:31:58 -04:00
parent dc5daca58f
commit 7f208e71c8

View file

@ -97,9 +97,7 @@ module Shoulda # :nodoc:
def allows_blank_value?
if @options.key?(:allow_blank)
blank_values = ['', ' ', "\n", "\r", "\t", "\f"]
@options[:allow_blank] == blank_values.inject(true) do |memo, value|
memo &&= allows_value_of(value)
end
@options[:allow_blank] == blank_values.all? { |value| allows_value_of(value) }
else
true
end