Class: RSpec::ChangeToNow::Matchers::Negate Private

Inherits:
Object
  • Object
show all
Includes:
Matchers::Composable, Matchers::Pretty
Defined in:
lib/rspec/change_to_now/matchers/negate.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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

Instance Method Summary collapse

Constructor Details

#initialize(matcher) ⇒ Negate

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Negate.



13
14
15
# File 'lib/rspec/change_to_now/matchers/negate.rb', line 13

def initialize(matcher)
  @matcher = matcher
end

Instance Method Details

#descriptionString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


51
52
53
# File 'lib/rspec/change_to_now/matchers/negate.rb', line 51

def description
  "~#{surface_descriptions_in(@matcher).inspect}"
end

#does_not_match?(*args, &block) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


29
30
31
# File 'lib/rspec/change_to_now/matchers/negate.rb', line 29

def does_not_match?(*args, &block)
  @matcher.matches?(*args, &block)
end

#failure_messageString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


35
36
37
38
39
40
41
# 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_negatedString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


45
46
47
# File 'lib/rspec/change_to_now/matchers/negate.rb', line 45

def failure_message_when_negated
  @matcher.failure_message
end

#matches?(*args, &block) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


19
20
21
22
23
24
25
# 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?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


57
58
59
# File 'lib/rspec/change_to_now/matchers/negate.rb', line 57

def supports_block_expectations?
  @matcher.supports_block_expectations?
end