Module: Surrogate::RSpec::MatchWithArguments
- Defined in:
- lib/surrogate/rspec/api_method_matchers.rb
Instance Attribute Summary collapse
-
#expected_arguments ⇒ Object
Returns the value of attribute expected_arguments.
Class Method Summary collapse
Instance Method Summary collapse
- #actual_invocation ⇒ Object
-
#match? ⇒ Boolean
eventually this will need to get a lot smarter.
Instance Attribute Details
#expected_arguments ⇒ Object
Returns the value of attribute expected_arguments.
116 117 118 |
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 116 def expected_arguments @expected_arguments end |
Class Method Details
.extended(klass) ⇒ Object
112 113 114 |
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 112 def self.extended(klass) klass. = :with end |
Instance Method Details
#actual_invocation ⇒ Object
126 127 128 129 130 |
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 126 def actual_invocation return :other, :not_invoked if times_invoked.zero? inspected_invocations = invocations.map { |invocation| inspect_arguments invocation } "got #{inspected_invocations.join ', '}" end |
#match? ⇒ Boolean
eventually this will need to get a lot smarter
118 119 120 121 122 123 124 |
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 118 def match? # eventually this will need to get a lot smarter if expected_arguments.size == 1 && expected_arguments.first.kind_of?(::RSpec::Mocks::ArgumentMatchers::NoArgsMatcher) invocations.include? [] else invocations.include? expected_arguments end end |