Permalink
Browse files

reformatted message tag spec

  • Loading branch information...
1 parent abb1d0c commit 1985879550c7d095e2b633914162fa25799ff508 @rubiii rubiii committed Mar 9, 2013
Showing with 21 additions and 22 deletions.
  1. +21 −22 spec/savon/features/message_tag_spec.rb
@@ -2,28 +2,6 @@
describe Savon do
- let(:globals) { Savon::GlobalOptions.new(:log => false) }
-
- def message_tag_for(fixture, operation_name)
- 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
-
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'])
@@ -59,4 +37,25 @@ def extract_namespace_from_request(nsid, xml)
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

0 comments on commit 1985879

Please sign in to comment.