spec/savon/soap_spec.rb in savon-0.6.8 vs spec/savon/soap_spec.rb in savon-0.7.0

- old
+ new

@@ -6,18 +6,18 @@ @soap.action = WSDLFixture.authentication(:operations)[:authenticate][:action] end it "contains the SOAP namespace for each supported SOAP version" do Savon::SOAPVersions.each do |soap_version| - Savon::SOAP::SOAPNamespace[soap_version].should be_a String + Savon::SOAP::SOAPNamespace[soap_version].should be_a(String) Savon::SOAP::SOAPNamespace[soap_version].should_not be_empty end end it "contains the Content-Types for each supported SOAP version" do Savon::SOAPVersions.each do |soap_version| - Savon::SOAP::ContentType[soap_version].should be_a String + Savon::SOAP::ContentType[soap_version].should be_a(String) Savon::SOAP::ContentType[soap_version].should_not be_empty end end it "defaults to SOAP 1.1" do @@ -45,11 +45,11 @@ it "has a setter for the SOAP input" do @soap.input = "FindUserRequest" end it "has both getter and setter for the SOAP header" do - @soap.header.should be_a Hash + @soap.header.should be_a(Hash) @soap.header.should be_empty @soap.header = { "specialAuthKey" => "secret" } @soap.header.should == { "specialAuthKey" => "secret" } end @@ -74,10 +74,18 @@ @soap.version = 2 @soap.namespaces.should == { "xmlns:env" => Savon::SOAP::SOAPNamespace[2] } end end + it "has a convenience method for setting the 'xmlns:wsdl' namespace" do + @soap.namespaces.should == { "xmlns:env" => "http://schemas.xmlsoap.org/soap/envelope/" } + + @soap.namespace = "http://example.com" + @soap.namespaces.should include("xmlns:env" => "http://schemas.xmlsoap.org/soap/envelope/") + @soap.namespaces.should include("xmlns:wsdl" => "http://example.com") + end + it "has both getter and setter for the SOAP endpoint" do @soap.endpoint.should be_nil soap_endpoint = URI EndpointHelper.soap_endpoint @soap.endpoint = soap_endpoint @@ -98,26 +106,26 @@ 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>' + @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>') end it "caches the XML, returning the same Object every time" do @soap.to_xml.object_id.should == @soap.to_xml.object_id end it "uses the SOAP namespace for the specified SOAP version" do @soap.version = 2 - @soap.to_xml.should include Savon::SOAP::SOAPNamespace[2] + @soap.to_xml.should include(Savon::SOAP::SOAPNamespace[2]) end it "uses the SOAP namespace for the default SOAP version otherwise" do Savon::SOAP.version = 2 - @soap.to_xml.should include Savon::SOAP::SOAPNamespace[2] + @soap.to_xml.should include(Savon::SOAP::SOAPNamespace[2]) end end end