Class: PoolParty::Verifiers::HttpMatch
- Inherits:
-
VerifierBase
- Object
- VerifierBase
- PoolParty::Verifiers::HttpMatch
- Defined in:
- lib/poolparty/verification/verifiers/http_match.rb
Overview
HttpMatch Verifier
Verify the body of an HTTP call matches a regular expression
Usage
http_match url, response_code
Example
verify do
http_match "http://host/index.html", /Welcome to your/
http_match "http://host/index.html", /new poolparty instance/
end
Instance Attribute Summary collapse
-
#regexp ⇒ Object
readonly
Returns the value of attribute regexp.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Attributes inherited from VerifierBase
Instance Method Summary collapse
-
#initialize(uri, regexp) ⇒ HttpMatch
constructor
A new instance of HttpMatch.
- #passing? ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from VerifierBase
Constructor Details
#initialize(uri, regexp) ⇒ HttpMatch
Returns a new instance of HttpMatch.
27 28 29 30 |
# File 'lib/poolparty/verification/verifiers/http_match.rb', line 27 def initialize(uri, regexp) @uri = URI.parse(uri) @regexp = regexp end |
Instance Attribute Details
#regexp ⇒ Object (readonly)
Returns the value of attribute regexp.
26 27 28 |
# File 'lib/poolparty/verification/verifiers/http_match.rb', line 26 def regexp @regexp end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
26 27 28 |
# File 'lib/poolparty/verification/verifiers/http_match.rb', line 26 def uri @uri end |
Instance Method Details
#passing? ⇒ Boolean
32 33 34 |
# File 'lib/poolparty/verification/verifiers/http_match.rb', line 32 def passing? @regexp.match(@uri.read) ? true : false end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/poolparty/verification/verifiers/http_match.rb', line 36 def to_s "<#{self.class.to_s} uri:#{uri} regexp:#{regexp}>" end |