Class: RSpec::Matchers::BuiltIn::YieldSuccessiveArgs Private
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::YieldSuccessiveArgs
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/yield.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 ‘yield_successive_args`. Not intended to be instantiated directly.
Constant Summary
Constants inherited from BaseMatcher
Instance Attribute Summary
Attributes inherited from BaseMatcher
#actual, #expected, #matcher_name, #rescued_exception
Instance Method Summary collapse
- #description ⇒ Object private
- #does_not_match?(block) ⇒ Boolean private
- #failure_message ⇒ Object private
- #failure_message_when_negated ⇒ Object private
-
#initialize(*args) ⇒ YieldSuccessiveArgs
constructor
private
A new instance of YieldSuccessiveArgs.
- #matches?(block) ⇒ Boolean private
- #supports_block_expectations? ⇒ Boolean private
- #supports_value_expectations? ⇒ Boolean private
Methods inherited from BaseMatcher
#actual_formatted, #diffable?, #expected_formatted, #expects_call_stack_jump?, #match_unless_raises, matcher_name
Methods included from BaseMatcher::DefaultFailureMessages
Methods included from BaseMatcher::HashFormatting
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
Constructor Details
#initialize(*args) ⇒ YieldSuccessiveArgs
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 YieldSuccessiveArgs.
297 298 299 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/yield.rb', line 297 def initialize(*args) @expected = args end |
Instance Method Details
#description ⇒ Object
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.
337 338 339 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/yield.rb', line 337 def description "yield successive args(#{expected_arg_description})" end |
#does_not_match?(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.
320 321 322 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/yield.rb', line 320 def does_not_match?(block) !matches?(block) && @probe.has_block? end |
#failure_message ⇒ Object
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.
325 326 327 328 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/yield.rb', line 325 def 'expected given block to yield successively with arguments, ' \ "but #{positive_failure_reason}" end |
#failure_message_when_negated ⇒ Object
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.
331 332 333 334 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/yield.rb', line 331 def 'expected given block not to yield successively with arguments, ' \ "but #{negative_failure_reason}" end |
#matches?(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.
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/yield.rb', line 302 def matches?(block) @actual_formatted = [] @actual = [] args_matched_when_yielded = true yield_count = 0 @probe = YieldProbe.probe(block) do |*arg_array| arg_or_args = arg_array.size == 1 ? arg_array.first : arg_array @actual_formatted << RSpec::Support::ObjectFormatter.format(arg_or_args) @actual << arg_or_args args_matched_when_yielded &&= values_match?(@expected[yield_count], arg_or_args) yield_count += 1 end return false unless @probe.has_block? args_matched_when_yielded && yield_count == @expected.length 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.
342 343 344 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/yield.rb', line 342 def supports_block_expectations? true end |
#supports_value_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.
347 348 349 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/yield.rb', line 347 def supports_value_expectations? false end |