Sha256: 2d41417278080c69724e7a04dd1cdbf60861f6764883e90305238b2d6745eeee
Contents?: true
Size: 875 Bytes
Versions: 16
Compression:
Stored size: 875 Bytes
Contents
module Shoulda module Matchers module ActiveModel # :nodoc # Usage example: be_boolean(:private) def be_boolean(attribute) BeBooleanMatcher.new(attribute) end class BeBooleanMatcher < ValidationMatcher # :nodoc: def initialize(attribute) @attribute = attribute end def matches?(subject) @subject = subject disallows_value_of(nil) && disallows_value_of("") && allows_value_of(true) && allows_value_of(false) end def description description = "#{@attribute} should be a boolean" end def failure_message "Expected #{@attribute} to be a boolean" end def negative_failure_message "Did not expect #{@attribute} to be a boolean" end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems