2012-10-16 17:45:06 +00:00
|
|
|
module Shoulda # :nodoc:
|
|
|
|
module Matchers
|
|
|
|
module ActiveModel # :nodoc:
|
|
|
|
class DisallowValueMatcher # :nodoc:
|
|
|
|
def initialize(value)
|
2012-10-23 16:30:18 +00:00
|
|
|
@allow_matcher = AllowValueMatcher.new(value)
|
2012-10-16 17:45:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def matches?(subject)
|
|
|
|
!@allow_matcher.matches?(subject)
|
|
|
|
end
|
|
|
|
|
|
|
|
def for(attribute)
|
|
|
|
@allow_matcher.for(attribute)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2013-07-02 02:16:32 +00:00
|
|
|
def on(context)
|
|
|
|
@allow_matcher.on(context)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2012-10-16 17:45:06 +00:00
|
|
|
def with_message(message)
|
|
|
|
@allow_matcher.with_message(message)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2013-01-08 17:29:01 +00:00
|
|
|
def failure_message_for_should
|
|
|
|
@allow_matcher.failure_message_for_should_not
|
2012-10-16 17:45:06 +00:00
|
|
|
end
|
|
|
|
|
2013-03-27 18:13:46 +00:00
|
|
|
def failure_message_for_should_not
|
|
|
|
@allow_matcher.failure_message_for_should
|
|
|
|
end
|
|
|
|
|
2012-10-16 17:45:06 +00:00
|
|
|
def allowed_types
|
2012-12-20 05:04:27 +00:00
|
|
|
''
|
2012-10-16 17:45:06 +00:00
|
|
|
end
|
2013-03-27 18:13:46 +00:00
|
|
|
|
|
|
|
def strict
|
|
|
|
@allow_matcher.strict
|
|
|
|
self
|
|
|
|
end
|
2012-10-16 17:45:06 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|