Sha256: f27968d2f7f31ee0fc976d580d4adb1afc03234137d54ee19e8f9da1b2db0681

Contents?: true

Size: 951 Bytes

Versions: 1

Compression:

Stored size: 951 Bytes

Contents

require_relative '../soaspec'
#require_relative 'basic_soap_handler'
# This represents a request / response pair
class Exchange

  attr_reader :xml_response

  attr_reader :xml_doc

  def initialize(name, override_parameters = {})
    @test_name = name.to_s
    @api_class = Soaspec::Environment.api_handler
    @override_parameters = override_parameters
  end

  # Make request to handler with parameters defined
  def make_request
    @api_class.make_request(@override_parameters)
  end

  # Name describing this class when used with `RSpec.describe`
  # @return [String] Name given when initializing
  def to_s
    @response = self.make_request
    if Soaspec::Environment.api_handler.class == Soaspec::BasicSoapHandler
      @xml_response = @response.to_xml
      @xml_doc = Nokogiri::XML(@xml_response)
    end
    @test_name
  end

  def contain(value)
    @xml_response.include? value
  end

  def status_code
    @response.http.code
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
soaspec-0.0.5 lib/soaspec/exchange.rb