Sha256: db1a5936dd4751357b428135c8b398bf06a494ab91fd2ba88420b2c6dd235856

Contents?: true

Size: 730 Bytes

Versions: 12

Compression:

Stored size: 730 Bytes

Contents

module PoolParty
  module Verifiers
    
=begin

== 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

=end

    class HttpMatch < VerifierBase
      require 'open-uri'
      
      attr_reader :uri, :regexp
      def initialize(uri, regexp)
        @uri    = URI.parse(uri)
        @regexp = regexp
      end

      def passing?
        @regexp.match(@uri.read) ? true : false
      end

      def to_s
        "<#{self.class.to_s} uri:#{uri} regexp:#{regexp}>"
      end

    end
    
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
auser-poolparty-1.2.1 lib/poolparty/verification/verifiers/http_match.rb
auser-poolparty-1.2.10 lib/poolparty/verification/verifiers/http_match.rb
auser-poolparty-1.2.11 lib/poolparty/verification/verifiers/http_match.rb
auser-poolparty-1.2.12 lib/poolparty/verification/verifiers/http_match.rb
auser-poolparty-1.2.2 lib/poolparty/verification/verifiers/http_match.rb
auser-poolparty-1.2.3 lib/poolparty/verification/verifiers/http_match.rb
auser-poolparty-1.2.4 lib/poolparty/verification/verifiers/http_match.rb
auser-poolparty-1.2.7 lib/poolparty/verification/verifiers/http_match.rb
auser-poolparty-1.2.8 lib/poolparty/verification/verifiers/http_match.rb
auser-poolparty-1.2.9 lib/poolparty/verification/verifiers/http_match.rb
fairchild-poolparty-1.2.12 lib/poolparty/verification/verifiers/http_match.rb
poolparty-1.2.2 lib/poolparty/verification/verifiers/http_match.rb