Sha256: da06e7db01e503526dd96f6cefc7082b3d181edae8c006348bb8f0203c43c74a

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

# encoding: UTF-8

require "spec_helper"

describe Shapewear do
  describe "usage with SOAP clients" do
    before do
      stub_request(:get, "http://services.example.com/complete/soap/wsdl") \
        .to_return :body => CompleteService.to_wsdl, :headers => { 'Content-Type' => 'application/xml' }

      stub_request(:post, "http://services.example.com/complete/soap") \
        .to_return :body => lambda { |r| CompleteService.serve(r) }, :headers => { 'Content-Type' => 'application/xml' }
    end

    describe "Savon" do
      it "should work for simple requests" do
        client = Savon::Client.new 'http://services.example.com/complete/soap/wsdl'
        response = client.request :echo_in_uppercase, :xmlns => 'http://services.example.com/v1' do
          soap.body = { :text => 'uppercase text' }
        end

        puts response.inspect
        puts response.body.inspect

        response.body[:echo_in_uppercase_response][:body].should == 'UPPERCASE TEXT'
      end

      it "should raise SOAP:Faults" do
        client = Savon::Client.new 'http://services.example.com/complete/soap/wsdl'

        expect {
          client.request :get_structured_data, :xmlns => 'http://services.example.com/v1' do
            soap.body = { :id => 55 }
          end
        }.to raise_error Savon::SOAP::Fault, "(RuntimeError) ID must be 0 or 1"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shapewear-0.1.0 spec/shapewear/savon_usage_spec.rb