Module: Surrogate::RSpec::MatchNumTimesWith
- Defined in:
- lib/surrogate/rspec/api_method_matchers.rb
Instance Attribute Summary collapse
-
#expected_arguments ⇒ Object
Returns the value of attribute expected_arguments.
-
#expected_times_invoked ⇒ Object
Returns the value of attribute expected_times_invoked.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#expected_arguments ⇒ Object
Returns the value of attribute expected_arguments.
152 153 154 |
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 152 def expected_arguments @expected_arguments end |
#expected_times_invoked ⇒ Object
Returns the value of attribute expected_times_invoked.
152 153 154 |
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 152 def expected_times_invoked @expected_times_invoked end |
Class Method Details
.extended(klass) ⇒ Object
148 149 150 |
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 148 def self.extended(klass) klass. = :with_times end |
Instance Method Details
#actual_invocation ⇒ Object
162 163 164 165 |
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 162 def actual_invocation return :other, :not_invoked if times_invoked.zero? "#{ :other, :invoked_description} #{times_msg times_invoked_with_expected_args}" end |
#match? ⇒ Boolean
158 159 160 |
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 158 def match? times_invoked_with_expected_args == expected_times_invoked end |
#times_invoked_with_expected_args ⇒ Object
154 155 156 |
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 154 def times_invoked_with_expected_args invocations.select { |invocation| invocation == expected_arguments }.size end |