Sha256: 778ad25a858915872f769a2ca4bb0ad38d24444fdaa07c02eeb36968822aad32
Contents?: true
Size: 1.84 KB
Versions: 1
Compression:
Stored size: 1.84 KB
Contents
require 'spec_helper' describe Savon do it 'knows the message tag for :authentication' do message_tag = message_tag_for(:authentication, :authenticate) expect(message_tag).to eq(['http://v1_0.ws.auth.order.example.com/', 'authenticate']) end it 'knows the message tag for :taxcloud' do message_tag = message_tag_for(:taxcloud, :verify_address) expect(message_tag).to eq(['http://taxcloud.net', 'VerifyAddress']) end it 'knows the message tag for :team_software' do message_tag = message_tag_for(:team_software, :login) expect(message_tag).to eq(['http://tempuri.org/', 'Login']) end it 'knows the message tag for :interhome' do message_tag = message_tag_for(:interhome, :price_list) expect(message_tag).to eq(['http://www.interhome.com/webservice', 'PriceList']) end it 'knows the message tag for :betfair' do message_tag = message_tag_for(:betfair, :get_bet) expect(message_tag).to eq(['http://www.betfair.com/publicapi/v5/BFExchangeService/', 'getBet']) end it 'knows the message tag for :wasmuth' do message_tag = message_tag_for(:wasmuth, :get_st_tables) expect(message_tag).to eq(['http://ws.online.msw/', 'getStTables']) end def message_tag_for(fixture, operation_name) globals = Savon::GlobalOptions.new(:log => false) wsdl = Wasabi::Document.new Fixture.wsdl(fixture) operation = Savon::Operation.create(operation_name, wsdl, globals) request_xml = operation.build.to_s nsid, local = extract_message_tag_from_request(request_xml) namespace = extract_namespace_from_request(nsid, request_xml) [namespace, local] end def extract_message_tag_from_request(xml) match = xml.match(/<\w+?:Body><(.+?):(.+?)>/) [ match[1], match[2] ] end def extract_namespace_from_request(nsid, xml) xml.match(/xmlns:#{nsid}="(.+?)"/)[1] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
savon-2.2.0 | spec/savon/features/message_tag_spec.rb |