class RSpec::ChangeToNow::Matchers::Negate

@api private Provides the implementation for ‘negate`. Not intended to be instantiated directly.

Public Class Methods

new(matcher) click to toggle source
# File lib/rspec/change_to_now/matchers/negate.rb, line 13
def initialize(matcher)
  @matcher = matcher
end

Public Instance Methods

description() click to toggle source

@api private @return [String]

# File lib/rspec/change_to_now/matchers/negate.rb, line 51
def description
  "~#{surface_descriptions_in(@matcher).inspect}"
end
does_not_match?(*args, &block) click to toggle source

@api private @return [Boolean]

# File lib/rspec/change_to_now/matchers/negate.rb, line 29
def does_not_match?(*args, &block)
  @matcher.matches?(*args, &block)
end
failure_message() click to toggle source

@private @return [String]

# File lib/rspec/change_to_now/matchers/negate.rb, line 35
def failure_message
  if @matcher.respond_to? :failure_message_when_negated
    @matcher.failure_message_when_negated
  elsif @matcher.respond_to? :description
    "expected #{surface_descriptions_in(@matcher.actual).inspect} not to #{surface_descriptions_in(@matcher).inspect}"
  end
end
failure_message_when_negated() click to toggle source

@api private @return [String]

# File lib/rspec/change_to_now/matchers/negate.rb, line 45
def failure_message_when_negated
  @matcher.failure_message
end
matches?(*args, &block) click to toggle source

@api private @return [Boolean]

# File lib/rspec/change_to_now/matchers/negate.rb, line 19
def matches?(*args, &block)
  if @matcher.respond_to?(:does_not_match?)
    @matcher.does_not_match?(*args, &block)
  else
    !@matcher.matches?(*args, &block)
  end
end
supports_block_expectations?() click to toggle source

@api private @return [Boolean]

# File lib/rspec/change_to_now/matchers/negate.rb, line 57
def supports_block_expectations?
  @matcher.supports_block_expectations?
end