Sha256: b8333cf2a26d90b27b20b80268260c088dfc89698414af676318328fec1db9b6

Contents?: true

Size: 757 Bytes

Versions: 4

Compression:

Stored size: 757 Bytes

Contents

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

  attr_reader :xml_response

  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
    @xml_response = @response.to_xml
    @test_name
  end

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

  def status_code
    @response.http.code
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
soaspec-0.0.4 lib/soaspec/exchange.rb
soaspec-0.0.3 lib/soaspec/exchange.rb
soaspec-0.0.2 lib/soaspec/exchange.rb
soaspec-0.0.1 lib/soaspec/exchange.rb