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.
-
#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.
31 32 33 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 31 def initialize(*args) @method, @url = args_split(*args) end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
24 25 26 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 24 def method @method end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
24 25 26 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 24 def url @url end |
Instance Method Details
#failure_message ⇒ String
Failure message if the URI should have been requested.
52 53 54 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 52 def regex?(@url) ? : end |
#matches?(fakeweb) ⇒ Boolean
Indication of whether there's a match on the URI from given requests.
41 42 43 44 45 46 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 41 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.
60 61 62 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 60 def regex?(@url) ? : end |