2012-10-16 13:45:06 -04:00
|
|
|
module Shoulda # :nodoc:
|
|
|
|
module Matchers
|
|
|
|
module ActiveModel # :nodoc:
|
|
|
|
class DisallowValueMatcher # :nodoc:
|
|
|
|
def initialize(value)
|
2012-10-23 12:30:18 -04:00
|
|
|
@allow_matcher = AllowValueMatcher.new(value)
|
2012-10-16 13:45:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def matches?(subject)
|
|
|
|
!@allow_matcher.matches?(subject)
|
|
|
|
end
|
|
|
|
|
|
|
|
def for(attribute)
|
|
|
|
@allow_matcher.for(attribute)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def with_message(message)
|
|
|
|
@allow_matcher.with_message(message)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def failure_message
|
|
|
|
@allow_matcher.negative_failure_message
|
|
|
|
end
|
|
|
|
|
|
|
|
def allowed_types
|
2012-12-20 00:04:27 -05:00
|
|
|
''
|
2012-10-16 13:45:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|