Sha256: ceeea31053e57020edef912c0289b62ee670ff3f4efc9f7e0801af091b9d6044

Contents?: true

Size: 840 Bytes

Versions: 13

Compression:

Stored size: 840 Bytes

Contents

 require "spec_helper"

describe "Stockquote example" do

  it "returns the result in a CDATA tag" do
    client = Savon.client(
      # The WSDL document provided by the service.
      :wsdl => "http://www.webservicex.net/stockquote.asmx?WSDL",

      # Lower timeouts so these specs don't take forever when the service is not available.
      :open_timeout => 10,
      :read_timeout => 10,

      # Disable logging for cleaner spec output.
      :log => false
    )

    response = call_and_fail_gracefully(client, :get_quote, :message => { :symbol => "AAPL" })

    cdata = response.body[:get_quote_response][:get_quote_result]

    nori_options = { :convert_tags_to => lambda { |tag| tag.snakecase.to_sym } }
    result = Nori.new(nori_options).parse(cdata)

    expect(result[:stock_quotes][:stock][:symbol]).to eq("AAPL")
  end

end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
savon-SU-2.11.1b spec/integration/stockquote_example_spec.rb
savon-SU-2.11.1 spec/integration/stockquote_example_spec.rb
savon-2.11.1 spec/integration/stockquote_example_spec.rb
savon-2.11.0 spec/integration/stockquote_example_spec.rb
savon-2.10.1 spec/integration/stockquote_example_spec.rb
savon-2.10.0 spec/integration/stockquote_example_spec.rb
savon-2.9.0 spec/integration/stockquote_example_spec.rb
savon-2.8.1 spec/integration/stockquote_example_spec.rb
savon-2.8.0 spec/integration/stockquote_example_spec.rb
savon-2.7.2 spec/integration/stockquote_example_spec.rb
savon-2.7.1 spec/integration/stockquote_example_spec.rb
savon-2.7.0 spec/integration/stockquote_example_spec.rb
savon-2.6.0 spec/integration/stockquote_example_spec.rb