Class: Surrogate::RSpec::WithFilter::RSpecMatchAsserter
- Inherits:
-
Object
- Object
- Surrogate::RSpec::WithFilter::RSpecMatchAsserter
- Defined in:
- lib/surrogate/rspec/with_filter.rb
Instance Attribute Summary collapse
-
#actual_invocation ⇒ Object
Returns the value of attribute actual_invocation.
-
#expected_invocation ⇒ Object
Returns the value of attribute expected_invocation.
Instance Method Summary collapse
- #approximate_2_11? ⇒ Boolean
-
#initialize(actual_invocation, expected_invocation) ⇒ RSpecMatchAsserter
constructor
A new instance of RSpecMatchAsserter.
- #match? ⇒ Boolean
- #matcher_class ⇒ Object
Constructor Details
#initialize(actual_invocation, expected_invocation) ⇒ RSpecMatchAsserter
Returns a new instance of RSpecMatchAsserter.
76 77 78 |
# File 'lib/surrogate/rspec/with_filter.rb', line 76 def initialize(actual_invocation, expected_invocation) self.actual_invocation, self.expected_invocation = actual_invocation, expected_invocation end |
Instance Attribute Details
#actual_invocation ⇒ Object
Returns the value of attribute actual_invocation.
74 75 76 |
# File 'lib/surrogate/rspec/with_filter.rb', line 74 def actual_invocation @actual_invocation end |
#expected_invocation ⇒ Object
Returns the value of attribute expected_invocation.
74 75 76 |
# File 'lib/surrogate/rspec/with_filter.rb', line 74 def expected_invocation @expected_invocation end |
Instance Method Details
#approximate_2_11? ⇒ Boolean
90 91 92 |
# File 'lib/surrogate/rspec/with_filter.rb', line 90 def approximate_2_11? Gem::Requirement.create('~> 2.11').satisfied_by? Gem::Version.new(::RSpec::Mocks::Version::STRING) end |
#match? ⇒ Boolean
80 81 82 83 |
# File 'lib/surrogate/rspec/with_filter.rb', line 80 def match? rspec_arg_expectation = matcher_class.new *expected_invocation.args rspec_arg_expectation.args_match? *actual_invocation.args end |
#matcher_class ⇒ Object
85 86 87 88 |
# File 'lib/surrogate/rspec/with_filter.rb', line 85 def matcher_class return ::RSpec::Mocks::ArgumentListMatcher if approximate_2_11? ::RSpec::Mocks::ArgumentExpectation end |