Sha256: ddd71af361e5c62cb7f0d96a9719f79c970b741a62c8d3990f38b1a02352cdea

Contents?: true

Size: 674 Bytes

Versions: 1

Compression:

Stored size: 674 Bytes

Contents

require 'net/http'
require 'outpost'

require 'outpost/expectations'

module Outpost
  module Scouts
    class Http < Outpost::Scout
      extend Outpost::Expectations::ResponseCode
      extend Outpost::Expectations::ResponseBody

      attr_reader :response_code, :response_body

      def setup(options)
        @host = options[:host]
        @port = options[:port] || 80
        @path = options[:path] || '/'
      end

      def execute
        # FIXME Apply Dependency Injection Principle here
        response = Net::HTTP.get_response(@host, @path, @port)
        @response_code = response.code.to_i
        @response_body = response.body
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
outpost-0.1.0 lib/outpost/scouts/http.rb