class Shoulda::Matchers::ActiveModel::NumericalityMatchers::EvenNumberMatcher
@private
Constants
- NON_EVEN_NUMBER_VALUE
Public Instance Methods
Source
# File lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb, line 20 def allowed_type_adjective 'even' end
Source
# File lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb, line 24 def diff_to_compare 2 end
Source
# File lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb, line 9 def simple_description description = '' if expects_strict? description << 'strictly ' end description + "disallow :#{attribute} from being an odd number" end
Protected Instance Methods
Source
# File lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb, line 34 def disallowed_value if @numeric_type_matcher.given_numeric_column? NON_EVEN_NUMBER_VALUE else NON_EVEN_NUMBER_VALUE.to_s end end
Source
# File lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb, line 30 def wrap_disallow_value_matcher(matcher) matcher.with_message(:even) end