Sha256: 252585a902b5066484a1a93a662e5bdff171f3c73c5a6ccd6fcccda301ebcee0

Contents?: true

Size: 1.61 KB

Versions: 12

Compression:

Stored size: 1.61 KB

Contents

require "spec_helper"

describe Savon::SOAP::Request do
  let(:request) { Savon::SOAP::Request.new HTTPI::Request.new, soap }
  let(:soap) { Savon::SOAP::XML.new Endpoint.soap, :get_user, :id => 1 }

  it "contains the content type for each supported SOAP version" do
    content_type = Savon::SOAP::Request::ContentType
    content_type[1].should == "text/xml;charset=UTF-8"
    content_type[2].should == "application/soap+xml;charset=UTF-8"
  end

  describe ".new" do
    it "should use the SOAP endpoint for the request" do
      request.request.url.should == URI(soap.endpoint)
    end

    it "should set the SOAP body for the request" do
      request.request.body.should == soap.to_xml
    end

    it "should set the 'Content-Type' header for SOAP 1.1" do
      request.request.headers["Content-Type"].should == Savon::SOAP::Request::ContentType[1]
    end

    it "should set the 'Content-Type' header for SOAP 1.2" do
      soap.version = 2
      request.request.headers["Content-Type"].should == Savon::SOAP::Request::ContentType[2]
    end

    it "should not set the 'Content-Type' header if it's already specified" do
      headers = { "Content-Type" => "text/plain" }
      request = Savon::SOAP::Request.new HTTPI::Request.new(:headers => headers), soap
      request.request.headers["Content-Type"].should == headers["Content-Type"]
    end
  end

  describe "#response" do
    it "should execute an HTTP POST request and return a Savon::SOAP::Response" do
      HTTPI.expects(:post).returns(HTTPI::Response.new 200, {}, Fixture.response(:authentication))
      request.response.should be_a(Savon::SOAP::Response)
    end
  end

end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
search_biomodel-1.0.0 search_biomodel/ruby/1.8/gems/savon-0.9.2/spec/savon/soap/request_spec.rb
savon-0.9.2 spec/savon/soap/request_spec.rb
s-savon-0.8.6 spec/savon/soap/request_spec.rb
savon-0.9.1 spec/savon/soap/request_spec.rb
savon-0.9.0 spec/savon/soap/request_spec.rb
savon-0.8.6 spec/savon/soap/request_spec.rb
savon-0.8.5 spec/savon/soap/request_spec.rb
savon-0.8.4 spec/savon/soap/request_spec.rb
savon-0.8.3 spec/savon/soap/request_spec.rb
savon-0.8.2 spec/savon/soap/request_spec.rb
savon-0.8.1 spec/savon/soap/request_spec.rb
savon-0.8.0 spec/savon/soap/request_spec.rb