Sha256: 5e1b69c068d0a8737341e55fc5685e1dd8957e80aa90191d7f563335ce4b7bab

Contents?: true

Size: 1.22 KB

Versions: 11

Compression:

Stored size: 1.22 KB

Contents

require 'helper'
require 'lolsoap/request'

module LolSoap
  describe Request do
    let(:envelope) { OpenStruct.new }
    subject { Request.new(envelope) }

    describe '#url' do
      it 'returns the envelope endpoint' do
        envelope.endpoint = 'lol'
        subject.url.must_equal 'lol'
      end
    end

    describe '#headers' do
      it 'returns the necessary headers' do
        def envelope.to_xml(options); '<lol>'; end
        envelope.action = 'http://example.com/LolOutLoud'

        subject.headers.must_equal({
          'Content-Type'   => 'application/soap+xml;charset=UTF-8',
          'Content-Length' => '5',
          'SOAPAction'     => 'http://example.com/LolOutLoud'
        })
      end
    end

    describe '#content' do
      it 'returns the envelope as an xml string' do
        def envelope.to_xml(options); '<lol>'; end
        subject.content.must_equal '<lol>'
      end
    end

    describe '#mime' do
      it 'is application/soap+xml for SOAP 1.2' do
        envelope.soap_version = '1.2'
        subject.mime.must_equal 'application/soap+xml'
      end

      it 'is text/xml for SOAP 1.1' do
        envelope.soap_version = '1.1'
        subject.mime.must_equal 'text/xml'
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lolsoap-0.6.1 test/unit/test_request.rb
lolsoap-0.6.0 test/unit/test_request.rb
lolsoap-0.5.1 test/unit/test_request.rb
lolsoap-0.5.0 test/unit/test_request.rb
lolsoap-0.4.2 test/unit/test_request.rb
lolsoap-0.4.1 test/unit/test_request.rb
lolsoap-0.4.0 test/unit/test_request.rb
lolsoap-0.3.2 test/unit/test_request.rb
lolsoap-0.3.1 test/unit/test_request.rb
lolsoap-0.3.0 test/unit/test_request.rb
lolsoap-0.2.0 test/unit/test_request.rb