Sha256: 68e15b130368c4d591248a1bd3e72e9870c1db316b431138e5cb80aa3cc6a845

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe 'Integration with Stockquote service' do

  subject(:client) { Sekken.new fixture('wsdl/stockquote') }

  let(:service_name) { :StockQuote }
  let(:port_name)    { :StockQuoteSoap }

  it 'creates an example request' do
    operation = client.operation(service_name, port_name, :GetQuote)

    expect(operation.example_body).to eq(
      GetQuote: {
        symbol: 'string'
      }
    )
  end

  it 'builds a request' do
    operation = client.operation(service_name, port_name, :GetQuote)

    operation.body = {
      GetQuote: {
        symbol: 'AAPL'
      }
    }

    expected = Nokogiri.XML(%{
      <env:Envelope
          xmlns:lol0="http://www.webserviceX.NET/"
          xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
        <env:Header/>
        <env:Body>
          <lol0:GetQuote>
            <lol0:symbol>AAPL</lol0:symbol>
          </lol0:GetQuote>
        </env:Body>
      </env:Envelope>
    })

    expect(Nokogiri.XML operation.build).
      to be_equivalent_to(expected).respecting_element_order
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sekken-0.3.0 spec/integration/stockquote_spec.rb
sekken-0.2.0 spec/integration/stockquote_spec.rb
sekken-0.1.0 spec/integration/stockquote_spec.rb