Class: RSpec::ChangeToNow::Matchers::Negate Private
- Inherits:
-
Object
- Object
- RSpec::ChangeToNow::Matchers::Negate
- 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
- #description ⇒ String private
- #does_not_match?(*args, &block) ⇒ Boolean private
- #failure_message ⇒ String private
- #failure_message_when_negated ⇒ String private
-
#initialize(matcher) ⇒ Negate
constructor
private
A new instance of Negate.
- #matches?(*args, &block) ⇒ Boolean private
- #supports_block_expectations? ⇒ Boolean private
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
#description ⇒ String
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.
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.
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_message ⇒ String
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.
35 36 37 38 39 40 41 |
# File 'lib/rspec/change_to_now/matchers/negate.rb', line 35 def if @matcher.respond_to? :failure_message_when_negated @matcher. 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 ⇒ String
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.
45 46 47 |
# File 'lib/rspec/change_to_now/matchers/negate.rb', line 45 def @matcher. 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.
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.
57 58 59 |
# File 'lib/rspec/change_to_now/matchers/negate.rb', line 57 def supports_block_expectations? @matcher.supports_block_expectations? end |