From 78a482f995db719e8fad6d9a5dae4a3fcc727c18 Mon Sep 17 00:00:00 2001 From: Mauro George Date: Wed, 1 Jul 2015 18:19:33 -0300 Subject: [PATCH] Keep consistency on allow_blank and allow_nil qualifiers After some discussion[1] was decided that these qualifiers do not accept any parameter. https://github.com/thoughtbot/shoulda-matchers/pull/722 --- .../active_model/validate_inclusion_of_matcher.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb index 4b96be052..f152cb540 100644 --- a/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb @@ -310,8 +310,8 @@ def in_range(range) self end - def allow_blank(allow_blank = true) - @options[:allow_blank] = allow_blank + def allow_blank + @options[:allow_blank] = true self end @@ -319,9 +319,8 @@ def expects_to_allow_blank? @options[:allow_blank] end - def allow_nil(allow_nil = true) - @options[:allow_nil] = allow_nil - self + def allow_nil + @options[:allow_nil] = true end def expects_to_allow_nil?