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.
40 41 42 43 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 40 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.
16 17 18 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 16 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.
24 25 26 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 24 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.
32 33 34 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 32 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.
91 92 93 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 91 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.
139 140 141 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 139 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.
64 65 66 67 68 69 70 71 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 64 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.
78 79 80 81 82 83 84 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 78 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.
121 122 123 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 121 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.
130 131 132 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 130 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.
51 52 53 54 55 56 57 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 51 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.
100 101 102 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 100 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.
148 149 150 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 148 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.
112 113 114 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb', line 112 def sub_matchers_ordered_by_index [arguments, return_value].compact end |