spec/savon/soap_spec.rb in savon-0.7.2 vs spec/savon/soap_spec.rb in savon-0.7.3
- old
+ new
@@ -41,11 +41,11 @@
@soap.action = "someAction"
@soap.action.should == "someAction"
end
it "has a setter for the SOAP input" do
- @soap.input = "FindUserRequest"
+ @soap.input = "FindUserRequest", { "username" => "auser", "anotherAttr" => "someVal" }
end
it "has both getter and setter for global SOAP headers" do
header = { "some" => "header" }
Savon::SOAP.header = header
@@ -122,12 +122,24 @@
it "returns the XML for a SOAP request" do
@soap.namespaces["xmlns:wsdl"] = "http://v1_0.ws.auth.order.example.com/"
@soap.body = { :id => 666 }
- @soap.to_xml.should include('xmlns:wsdl="http://v1_0.ws.auth.order.example.com/"')
- @soap.to_xml.should include('xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"')
- @soap.to_xml.should include('<wsdl:authenticate><id>666</id></wsdl:authenticate>')
+ xml = @soap.to_xml
+ xml.should include('xmlns:wsdl="http://v1_0.ws.auth.order.example.com/"')
+ xml.should include('xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"')
+ xml.should include('<wsdl:authenticate><id>666</id></wsdl:authenticate>')
+ end
+
+ it "does not include an empty header tag" do
+ @soap.to_xml.should_not include('env:Header')
+ end
+
+ it "returns the appropriate XML for a SOAP Body's root node when parameters are present" do
+ @soap.input = "authenticate", { "protocol" => "tls", "version" => "1.2" }
+ @soap.body = { :id => 666 }
+
+ @soap.to_xml.should include('<wsdl:authenticate protocol="tls" version="1.2"><id>666</id></wsdl:authenticate>')
end
it "caches the XML, returning the same Object every time" do
@soap.to_xml.object_id.should == @soap.to_xml.object_id
end