Class: ConvenientService::RSpec::PrimitiveMatchers::Classes::DelegateTo::Entities::SubMatcherCollection
- Inherits:
-
Object
- Object
- ConvenientService::RSpec::PrimitiveMatchers::Classes::DelegateTo::Entities::SubMatcherCollection
- Defined in:
- lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb
Instance Attribute Summary collapse
- #block_expectation_value ⇒ Object readonly private
- #matcher ⇒ Object readonly private
- #sub_matchers ⇒ Object readonly private
Instance Method Summary collapse
- #arguments ⇒ ConvenientService::RSpec::PrimitiveMatchers::Classes::DelegateTo::Entities::SubMatchers::Arguments private
- #arguments=(sub_matcher) ⇒ Object private
- #failure_message ⇒ String private
- #failure_message_when_negated ⇒ String private
- #has_arguments? ⇒ Boolean private
- #has_return_value? ⇒ Boolean private
- #initialize(matcher:) ⇒ void constructor private
- #matches?(block_expectation) ⇒ Boolean private
- #return_value ⇒ ConvenientService::RSpec::PrimitiveMatchers::Classes::DelegateTo::Entities::SubMatchers::ReturnValue? private
- #return_value=(sub_matcher) ⇒ Object private
- #sub_matchers_ordered_by_index ⇒ Array private
Constructor Details
#initialize(matcher:) ⇒ void
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 48 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 45 def initialize(matcher:) @matcher = matcher @sub_matchers = {} end |
Instance Attribute Details
#block_expectation_value ⇒ Object (readonly)
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.
21 22 23 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 21 def block_expectation_value @block_expectation_value end |
#matcher ⇒ Object (readonly)
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/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 29 def matcher @matcher end |
#sub_matchers ⇒ Object (readonly)
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.
37 38 39 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 37 def sub_matchers @sub_matchers end |
Instance Method Details
#arguments ⇒ ConvenientService::RSpec::PrimitiveMatchers::Classes::DelegateTo::Entities::SubMatchers::Arguments
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.
96 97 98 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 96 def arguments sub_matchers[:arguments] ||= Entities::SubMatchers::WithAnyArguments.new(matcher: matcher) end |
#arguments=(sub_matcher) ⇒ 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.
144 145 146 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 144 def arguments=(sub_matcher) sub_matchers[:arguments] = sub_matcher 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.
69 70 71 72 73 74 75 76 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 69 def sub_matchers_ordered_by_index .lazy .reject { |sub_matcher| sub_matcher.matches?(block_expectation_value) } .first &. .to_s 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.
83 84 85 86 87 88 89 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 83 def sub_matchers_ordered_by_index .reject { |sub_matcher| sub_matcher.does_not_match?(block_expectation_value) } .last &. .to_s end |
#has_arguments? ⇒ 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.
126 127 128 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 126 def has_arguments? sub_matchers.has_key?(:arguments) end |
#has_return_value? ⇒ 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.
135 136 137 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 135 def has_return_value? sub_matchers.has_key?(:return_value) end |
#matches?(block_expectation) ⇒ 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.
56 57 58 59 60 61 62 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 56 def matches?(block_expectation) sub_matchers_ordered_by_index.each(&:apply_stubs!) @block_expectation_value = block_expectation.call sub_matchers_ordered_by_index.all? { |sub_matcher| sub_matcher.matches?(@block_expectation_value) } end |
#return_value ⇒ ConvenientService::RSpec::PrimitiveMatchers::Classes::DelegateTo::Entities::SubMatchers::ReturnValue?
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.
105 106 107 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 105 def return_value sub_matchers[:return_value] end |
#return_value=(sub_matcher) ⇒ 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.
153 154 155 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 153 def return_value=(sub_matcher) sub_matchers[:return_value] = sub_matcher end |
#sub_matchers_ordered_by_index ⇒ Array
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.
117 118 119 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 117 def sub_matchers_ordered_by_index [arguments, return_value].compact end |