Class: FakeWebMatcher::RequestMatcher
- Inherits:
-
Object
- Object
- FakeWebMatcher::RequestMatcher
- Defined in:
- lib/fake_web_matcher/request_matcher.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#failure_message ⇒ String
Failure message if the URI should have been requested.
-
#failure_message_when_negated ⇒ String
Failure message if the URI should not have been requested.
-
#initialize(*args) ⇒ RequestMatcher
constructor
Create a new matcher.
-
#matches?(fakeweb) ⇒ Boolean
Indication of whether there's a match on the URI from given requests.
-
#negative_failure_message ⇒ String
Failure message if the URI should not have been requested.
Constructor Details
#initialize(*args) ⇒ RequestMatcher
Create a new matcher.
36 37 38 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 36 def initialize(*args) @method, @url = args_split(*args) end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
29 30 31 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 29 def method @method end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
29 30 31 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 29 def url @url end |
Instance Method Details
#failure_message ⇒ String
Failure message if the URI should have been requested.
57 58 59 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 57 def regex?(@url) ? : end |
#failure_message_when_negated ⇒ String
Failure message if the URI should not have been requested.
73 74 75 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 73 def regex?(@url) ? : end |
#matches?(fakeweb) ⇒ Boolean
Indication of whether there's a match on the URI from given requests.
46 47 48 49 50 51 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 46 def matches?(fakeweb) !FakeWeb::Registry.instance.requests.detect { |req| method, url = args_split(*req) match_method(method) && match_url(url) }.nil? end |
#negative_failure_message ⇒ String
Failure message if the URI should not have been requested. (Deprecated)
65 66 67 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 65 def regex?(@url) ? : end |