Sha256: d1781ffd4b682ee49380022b08ff5ff8f1c79fc96796d99401bc529206dcb173

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

module Shoulda # :nodoc:
  module Matchers
    module ActiveModel # :nodoc:
      class DisallowValueMatcher # :nodoc:
        def initialize(value)
          @allow_matcher = AllowValueMatcher.new(value)
        end

        def matches?(subject)
          !@allow_matcher.matches?(subject)
        end

        def for(attribute)
          @allow_matcher.for(attribute)
          self
        end

        def on(context)
          @allow_matcher.on(context)
          self
        end

        def with_message(message, options={})
          @allow_matcher.with_message(message, options)
          self
        end

        def failure_message
          @allow_matcher.failure_message_when_negated
        end
        alias failure_message_for_should failure_message

        def failure_message_when_negated
          @allow_matcher.failure_message
        end
        alias failure_message_for_should_not failure_message_when_negated

        def strict
          @allow_matcher.strict
          self
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoulda-matchers-2.6.0 lib/shoulda/matchers/active_model/disallow_value_matcher.rb