Sha256: 29deca750ff86989c1c59dc67545c04470d3a8716dafcb43b5db84fab4ac1839

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

require 'helper'
require 'lolsoap/request'

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

    [:header, :body, :soap_namespace, :input_type, :output_type].each do |method|
      describe "##{method}" do
        let(:envelope) { MiniTest::Mock.new }

        it 'delegates to the envelope' do
          ret = Object.new
          envelope.expect(method, ret)
          subject.send(method).must_equal ret
        end
      end
    end

    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
        envelope.to_xml = '<lol>'
        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
        envelope.to_xml = '<lol>'
        subject.content.must_equal '<lol>'
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lolsoap-0.1.4 test/unit/test_request.rb
lolsoap-0.1.3 test/unit/test_request.rb
lolsoap-0.1.2 test/unit/test_request.rb
lolsoap-0.1.1 test/unit/test_request.rb
lolsoap-0.1.0 test/unit/test_request.rb