Sha256: e0917d4c874927521d384118f94a1fb3559982dd8c46345577026e85960f96d8

Contents?: true

Size: 1.45 KB

Versions: 8

Compression:

Stored size: 1.45 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

    describe '#output_type' do
      it 'returns output body content type' do
        content_type = Object.new
        envelope.output_body_content_type = content_type
        subject.output_type.must_equal content_type
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lolsoap-0.11.0 test/unit/test_request.rb
lolsoap-0.10.0 test/unit/test_request.rb
lolsoap-0.9.0 test/unit/test_request.rb
lolsoap-0.8.3 test/unit/test_request.rb
lolsoap-0.8.2 test/unit/test_request.rb
lolsoap-0.8.1 test/unit/test_request.rb
lolsoap-0.8.0 test/unit/test_request.rb
lolsoap-0.7.0 test/unit/test_request.rb