Sha256: d1b3df55f935fe6f89819cbb1e4356615f937bbfbfc6ea17f6f7a4a13db496cd

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

require 'helper'
require 'lolsoap/envelope'
require 'lolsoap/wsdl'

module LolSoap
  describe Envelope do
    let(:wsdl) { WSDL.parse(File.read(TEST_ROOT + '/fixtures/stock_quote.wsdl')) }
    subject { Envelope.new(wsdl, wsdl.operations['GetLastTradePrice']) }

    let(:doc) { subject.doc }

    it 'creates an empty envelope' do
      body = doc.at_xpath('/soap:Envelope/soap:Body/xsd1:TradePriceRequest', doc.namespaces)
      body.wont_equal nil
    end

    it 'creates some input' do
      subject.body do |b|
        b.tickerSymbol 'LOCO2'
        b.specialTickerSymbol do |s|
          s.name 'LOCOLOCOLOCO'
        end
        b.lol
      end

      el = doc.at_xpath('//xsd1:TradePriceRequest/xsd1:tickerSymbol', doc.namespaces)
      el.wont_equal nil
      el.text.to_s.must_equal 'LOCO2'

      el = doc.at_xpath('//xsd1:TradePriceRequest/xsd1:specialTickerSymbol/xsd2:name', doc.namespaces)
      el.wont_equal nil
      el.text.to_s.must_equal 'LOCOLOCOLOCO'
    end

    it 'creates some header' do
      subject.header do |h|
        h['xsd1'].verySpecialBoolean true
      end

      el = doc.at_xpath('/soap:Envelope/soap:Header/xsd1:verySpecialBoolean', doc.namespaces)
      el.wont_equal nil
      el.text.to_s.must_equal 'true'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lolsoap-0.1.4 test/integration/test_envelope.rb
lolsoap-0.1.3 test/integration/test_envelope.rb
lolsoap-0.1.2 test/integration/test_envelope.rb
lolsoap-0.1.1 test/integration/test_envelope.rb
lolsoap-0.1.0 test/integration/test_envelope.rb