Sha256: 3791e78e1c3afdfa087854ee7b663e68f46e1faf22928ce6ac9fce4702c70569

Contents?: true

Size: 951 Bytes

Versions: 19

Compression:

Stored size: 951 Bytes

Contents

require "minitest/autorun"
require "fog"

# @note This is going to be part of fog-xml eventually
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

19 entries across 19 versions & 4 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/spec/fog/xml/connection_spec.rb
fog-1.28.0 spec/fog/xml/connection_spec.rb
fog-1.27.0 spec/fog/xml/connection_spec.rb
fog-1.26.0 spec/fog/xml/connection_spec.rb
fog-1.25.0 spec/fog/xml/connection_spec.rb
nsidc-fog-1.24.1 spec/fog/xml/connection_spec.rb
fog-1.24.0 spec/fog/xml/connection_spec.rb
ns-fog-1.22.11 spec/fog/xml/connection_spec.rb
ns-fog-1.22.10 spec/fog/xml/connection_spec.rb
ns-fog-1.22.9 spec/fog/xml/connection_spec.rb
ns-fog-1.22.8 spec/fog/xml/connection_spec.rb
ns-fog-1.22.7 spec/fog/xml/connection_spec.rb
ns-fog-1.22.6 spec/fog/xml/connection_spec.rb
fog-1.23.0 spec/fog/xml/connection_spec.rb
ns-fog-1.22.4 spec/fog/xml/connection_spec.rb
ns-fog-1.22.3 spec/fog/xml/connection_spec.rb
ns-fog-1.22.2 spec/fog/xml/connection_spec.rb
fog-1.22.1 spec/fog/xml/connection_spec.rb
fog-1.22.0 spec/fog/xml/connection_spec.rb