Class: WebMock::WebMockMatcher
- Inherits:
-
Object
- Object
- WebMock::WebMockMatcher
- Defined in:
- lib/webmock/rspec/matchers/webmock_matcher.rb
Instance Method Summary collapse
- #at_least_once ⇒ Object
- #at_least_times(times) ⇒ Object
- #at_least_twice ⇒ Object
- #description ⇒ Object
- #does_not_match?(webmock) ⇒ Boolean
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object (also: #negative_failure_message)
-
#initialize(method, uri) ⇒ WebMockMatcher
constructor
A new instance of WebMockMatcher.
- #matches?(webmock) ⇒ Boolean
- #once ⇒ Object
- #times(times) ⇒ Object
- #twice ⇒ Object
- #with(options = {}, &block) ⇒ Object
Constructor Details
#initialize(method, uri) ⇒ WebMockMatcher
Returns a new instance of WebMockMatcher.
6 7 8 9 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 6 def initialize(method, uri) @request_execution_verifier = RequestExecutionVerifier.new @request_execution_verifier.request_pattern = RequestPattern.new(method, uri) end |
Instance Method Details
#at_least_once ⇒ Object
21 22 23 24 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 21 def at_least_once @request_execution_verifier.at_least_times_executed = 1 self end |
#at_least_times(times) ⇒ Object
31 32 33 34 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 31 def at_least_times(times) @request_execution_verifier.at_least_times_executed = times self end |
#at_least_twice ⇒ Object
26 27 28 29 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 26 def at_least_twice @request_execution_verifier.at_least_times_executed = 2 self end |
#description ⇒ Object
62 63 64 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 62 def description @request_execution_verifier.description end |
#does_not_match?(webmock) ⇒ Boolean
50 51 52 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 50 def does_not_match?(webmock) @request_execution_verifier.does_not_match? end |
#failure_message ⇒ Object
54 55 56 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 54 def @request_execution_verifier. end |
#failure_message_when_negated ⇒ Object Also known as: negative_failure_message
58 59 60 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 58 def @request_execution_verifier. end |
#matches?(webmock) ⇒ Boolean
46 47 48 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 46 def matches?(webmock) @request_execution_verifier.matches? end |
#once ⇒ Object
11 12 13 14 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 11 def once @request_execution_verifier.expected_times_executed = 1 self end |
#times(times) ⇒ Object
41 42 43 44 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 41 def times(times) @request_execution_verifier.expected_times_executed = times.to_i self end |
#twice ⇒ Object
16 17 18 19 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 16 def twice @request_execution_verifier.expected_times_executed = 2 self end |
#with(options = {}, &block) ⇒ Object
36 37 38 39 |
# File 'lib/webmock/rspec/matchers/webmock_matcher.rb', line 36 def with( = {}, &block) @request_execution_verifier.request_pattern.with(, &block) self end |