spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb in rubiii-apricoteatsgorilla-0.5.5 vs spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb in rubiii-apricoteatsgorilla-0.5.6

- old
+ new

@@ -14,23 +14,39 @@ # soap_envelope describe "soap_envelope" do before { ApricotEatsGorilla.sort_keys = true } - it "returns a SOAP envelope with an empty-element body tag" do + it "returns an empty SOAP envelope with a SOAP 1.1 envelope namespace" do ApricotEatsGorilla.soap_envelope.should == '<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">' << '<env:Body /></env:Envelope>' end - + it "returns a SOAP envelope with a custom namespace and body content" do - result = ApricotEatsGorilla.soap_envelope(:wsdl => "http://example.com") do + ApricotEatsGorilla.soap_envelope(:wsdl => "http://example.com") do "<id>123</id>" - end - result.should == '<env:Envelope' << + end.should == '<env:Envelope' << ' xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"' << ' xmlns:wsdl="http://example.com">' << '<env:Body><id>123</id></env:Body></env:Envelope>' + end + + it "does not change an already defined SOAP envelope namespace" do + ApricotEatsGorilla.soap_envelope(:env => "http://example.com").should == + '<env:Envelope xmlns:env="http://example.com">' << + '<env:Body /></env:Envelope>' + end + + it "sets the SOAP envelope namespace for SOAP version 1.2 if requested" do + ApricotEatsGorilla.soap_envelope({}, 2).should == + '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">' << + '<env:Body /></env:Envelope>' + end + + it "does not set a SOAP envelope namespace in case of an invalid SOAP version" do + ApricotEatsGorilla.soap_envelope({}, 123).should == + '<env:Envelope><env:Body /></env:Envelope>' end end # [] describe "[]" do