Sha256: 66c5662cca0349f003de96749a59857a0dbfdfd5671d058508d558a9098ae299

Contents?: true

Size: 881 Bytes

Versions: 10

Compression:

Stored size: 881 Bytes

Contents

require "minitest_helper"

describe Fog::XML::Connection do
  before do
    @connection = Fog::XML::Connection.new("http://localhost")
  end

  after do
    Excon.stubs.clear
  end

  it "responds to #request" do
    assert_respond_to @connection, :request
  end

  describe "when request is passed a parser" do
    it "returns the body after parsing" do
      @parser = Fog::ToHashDocument.new
      Excon.stub({}, { :status => 200, :body => "<xml></xml>" })
      response = @connection.request(:parser => @parser, :mock => true)
      assert_equal({ :xml => "" }, response.body)
    end
  end

  describe "when request excludes a parser" do
    it "returns the response body without change" do
      Excon.stub({}, { :status => 200, :body => "<xml></xml>" })
      response = @connection.request(:mock => true)
      assert_equal("<xml></xml>", response.body)
    end
  end
end

Version data entries

10 entries across 8 versions & 3 rubygems

Version Path
fog-xml-0.1.5 spec/fog/xml/connection_spec.rb
fog-xml-0.1.4 spec/fog/xml/connection_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-xml-0.1.3/spec/fog/xml/connection_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-xml-0.1.3/spec/fog/xml/connection_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-xml-0.1.3/spec/fog/xml/connection_spec.rb
fog-xml-0.1.3 spec/fog/xml/connection_spec.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-xml-0.1.2/spec/fog/xml/connection_spec.rb
fog-xml-0.1.2 spec/fog/xml/connection_spec.rb
fog-xml-0.1.1 spec/fog/xml/connection_spec.rb
fog-xml-0.1.0 spec/fog/xml/connection_spec.rb