Sha256: a30861dc2d1f92cfbf4afbfa6a1c1f1398d2e97dcd5ab4d7af064f8d7449e144

Contents?: true

Size: 1.36 KB

Versions: 6

Compression:

Stored size: 1.36 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
        b.id 42
      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'

      attr = doc.at_xpath('//xsd1:tradePriceRequest/@id', doc.namespaces)
      attr.to_s.must_equal "42"
    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

6 entries across 6 versions & 1 rubygems

Version Path
lolsoap-0.4.2 test/integration/test_envelope.rb
lolsoap-0.4.1 test/integration/test_envelope.rb
lolsoap-0.4.0 test/integration/test_envelope.rb
lolsoap-0.3.2 test/integration/test_envelope.rb
lolsoap-0.3.1 test/integration/test_envelope.rb
lolsoap-0.3.0 test/integration/test_envelope.rb