Class: RSpec::Matchers::BuiltIn::BePredicate Private
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::BePredicate
- Defined in:
- lib/rspec/matchers/built_in/be.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 of be_<predicate>
.
Not intended to be instantiated directly.
Constant Summary
Constants inherited from BaseMatcher
RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED
Instance Method Summary collapse
- #description ⇒ String private
- #does_not_match?(actual, &block) ⇒ Boolean private
- #failure_message ⇒ String private
- #failure_message_when_negated ⇒ String private
-
#initialize(*args, &block) ⇒ BePredicate
constructor
private
A new instance of BePredicate.
- #matches?(actual, &block) ⇒ Boolean private
Methods inherited from BaseMatcher
#diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
Constructor Details
#initialize(*args, &block) ⇒ BePredicate
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 BePredicate.
184 185 186 187 188 |
# File 'lib/rspec/matchers/built_in/be.rb', line 184 def initialize(*args, &block) @expected = parse_expected(args.shift) @args = args @block = block 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.
216 217 218 |
# File 'lib/rspec/matchers/built_in/be.rb', line 216 def description "#{prefix_to_sentence}#{expected_to_sentence}#{args_to_sentence}" end |
#does_not_match?(actual, &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.
196 197 198 199 200 |
# File 'lib/rspec/matchers/built_in/be.rb', line 196 def does_not_match?(actual, &block) @actual = actual @block ||= block predicate_accessible? && !predicate_matches? 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.
204 205 206 |
# File 'lib/rspec/matchers/built_in/be.rb', line 204 def (true) 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.
210 211 212 |
# File 'lib/rspec/matchers/built_in/be.rb', line 210 def (false) end |
#matches?(actual, &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.
190 191 192 193 194 |
# File 'lib/rspec/matchers/built_in/be.rb', line 190 def matches?(actual, &block) @actual = actual @block ||= block predicate_accessible? && predicate_matches? end |