savon 2.12.1 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +87 -73
- data/CONTRIBUTING.md +15 -19
- data/Gemfile +2 -7
- data/README.md +14 -16
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
- data/coverage/assets/0.12.3/application.css +1 -0
- data/coverage/assets/0.12.3/application.js +7 -0
- data/coverage/assets/0.12.3/colorbox/border.png +0 -0
- data/coverage/assets/0.12.3/colorbox/controls.png +0 -0
- data/coverage/assets/0.12.3/colorbox/loading.gif +0 -0
- data/coverage/assets/0.12.3/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.12.3/favicon_green.png +0 -0
- data/coverage/assets/0.12.3/favicon_red.png +0 -0
- data/coverage/assets/0.12.3/favicon_yellow.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/assets/0.12.3/loading.gif +0 -0
- data/coverage/assets/0.12.3/magnify.png +0 -0
- data/coverage/index.html +21518 -0
- data/lib/savon/block_interface.rb +1 -0
- data/lib/savon/builder.rb +95 -29
- data/lib/savon/client.rb +1 -0
- data/lib/savon/core_ext/string.rb +1 -0
- data/lib/savon/header.rb +2 -6
- data/lib/savon/http_error.rb +4 -4
- data/lib/savon/log_message.rb +1 -0
- data/lib/savon/message.rb +1 -0
- data/lib/savon/mock/expectation.rb +1 -0
- data/lib/savon/mock/spec_helper.rb +1 -0
- data/lib/savon/mock.rb +1 -0
- data/lib/savon/model.rb +1 -0
- data/lib/savon/operation.rb +20 -18
- data/lib/savon/options.rb +56 -0
- data/lib/savon/qualified_message.rb +3 -2
- data/lib/savon/request.rb +5 -0
- data/lib/savon/request_logger.rb +8 -2
- data/lib/savon/response.rb +48 -1
- data/lib/savon/soap_fault.rb +1 -0
- data/lib/savon/version.rb +2 -1
- data/lib/savon.rb +1 -0
- data/savon.gemspec +9 -8
- data/spec/integration/support/application.rb +33 -1
- data/spec/integration/support/server.rb +1 -0
- data/spec/integration/zipcode_example_spec.rb +5 -8
- data/spec/savon/builder_spec.rb +2 -1
- data/spec/savon/client_spec.rb +5 -4
- data/spec/savon/core_ext/string_spec.rb +2 -1
- data/spec/savon/features/message_tag_spec.rb +2 -1
- data/spec/savon/http_error_spec.rb +9 -1
- data/spec/savon/log_message_spec.rb +2 -1
- data/spec/savon/message_spec.rb +2 -11
- data/spec/savon/mock_spec.rb +2 -1
- data/spec/savon/model_spec.rb +2 -1
- data/spec/savon/multipart_request_spec.rb +46 -0
- data/spec/savon/observers_spec.rb +2 -1
- data/spec/savon/operation_spec.rb +20 -43
- data/spec/savon/options_spec.rb +40 -1
- data/spec/savon/qualified_message_spec.rb +2 -1
- data/spec/savon/request_logger_spec.rb +2 -1
- data/spec/savon/request_spec.rb +47 -6
- data/spec/savon/response_spec.rb +2 -1
- data/spec/savon/soap_fault_spec.rb +2 -1
- data/spec/savon/softlayer_spec.rb +3 -2
- data/spec/spec_helper.rb +5 -4
- data/spec/support/adapters.rb +1 -0
- data/spec/support/endpoint.rb +1 -0
- data/spec/support/fixture.rb +1 -0
- data/spec/support/integration.rb +1 -0
- data/spec/support/stdout.rb +1 -0
- metadata +81 -30
- data/.travis.yml +0 -26
- data/donate.png +0 -0
- data/spec/integration/centra_spec.rb +0 -67
- data/spec/integration/email_example_spec.rb +0 -32
- data/spec/integration/random_quote_spec.rb +0 -23
- data/spec/integration/ratp_example_spec.rb +0 -28
- data/spec/integration/stockquote_example_spec.rb +0 -34
- data/spec/integration/temperature_example_spec.rb +0 -46
| @@ -1,3 +1,4 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require "rack"
         | 
| 2 3 | 
             
            require "json"
         | 
| 3 4 |  | 
| @@ -6,7 +7,7 @@ class IntegrationServer | |
| 6 7 | 
             
              def self.respond_with(options = {})
         | 
| 7 8 | 
             
                code = options.fetch(:code, 200)
         | 
| 8 9 | 
             
                body = options.fetch(:body, "")
         | 
| 9 | 
            -
                headers = { "Content-Type" => "text/plain", "Content-Length" => body.size.to_s }
         | 
| 10 | 
            +
                headers = { "Content-Type" => "text/plain", "Content-Length" => body.size.to_s }.merge options.fetch(:headers, {})
         | 
| 10 11 |  | 
| 11 12 | 
             
                [code, headers, [body]]
         | 
| 12 13 | 
             
              end
         | 
| @@ -78,5 +79,36 @@ class IntegrationServer | |
| 78 79 | 
             
                  run app
         | 
| 79 80 | 
             
                end
         | 
| 80 81 |  | 
| 82 | 
            +
                map "/multipart" do
         | 
| 83 | 
            +
                  run lambda { |env|
         | 
| 84 | 
            +
                    boundary = 'mimepart_boundary'
         | 
| 85 | 
            +
                    message = Mail.new
         | 
| 86 | 
            +
                    xml_part = Mail::Part.new do
         | 
| 87 | 
            +
                      content_type 'text/xml'
         | 
| 88 | 
            +
                      body %{<?xml version='1.0' encoding='UTF-8'?>
         | 
| 89 | 
            +
            <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         | 
| 90 | 
            +
              <soapenv:Header>response header</soapenv:Header>
         | 
| 91 | 
            +
              <soapenv:Body>response body</soapenv:Body>
         | 
| 92 | 
            +
            </soapenv:Envelope>}
         | 
| 93 | 
            +
                      # in Content-Type the start parameter is recommended (RFC 2387)
         | 
| 94 | 
            +
                      content_id '<soap-request-body@soap>'
         | 
| 95 | 
            +
                    end
         | 
| 96 | 
            +
                    message.add_part xml_part
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                    message.add_file File.expand_path("../../../fixtures/gzip/message.gz", __FILE__)
         | 
| 99 | 
            +
                    message.parts.last.content_location = 'message.gz'
         | 
| 100 | 
            +
                    message.parts.last.content_id = 'attachment1'
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                    message.ready_to_send!
         | 
| 103 | 
            +
                    message.body.set_sort_order [ "text/xml" ]
         | 
| 104 | 
            +
                    message.body.encoded(message.content_transfer_encoding)
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                    IntegrationServer.respond_with({
         | 
| 107 | 
            +
                      headers: { "Content-Type" => "multipart/related; boundary=\"#{message.body.boundary}\"; type=\"text/xml\"; start=\"#{xml_part.content_id}\"" },
         | 
| 108 | 
            +
                      body: message.body.encoded(message.content_transfer_encoding)
         | 
| 109 | 
            +
                    })
         | 
| 110 | 
            +
                  }
         | 
| 111 | 
            +
                end
         | 
| 112 | 
            +
             | 
| 81 113 | 
             
              end
         | 
| 82 114 | 
             
            end
         | 
| @@ -1,18 +1,16 @@ | |
| 1 | 
            -
              | 
| 2 | 
            -
             | 
| 3 | 
            -
            describe "ZIP code example" do
         | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
            require "spec_helper"
         | 
| 4 3 |  | 
| 4 | 
            +
            RSpec.describe "ZIP code example" do
         | 
| 5 5 | 
             
              it "supports threads making requests simultaneously" do
         | 
| 6 6 | 
             
                client = Savon.client(
         | 
| 7 | 
            -
                  # The WSDL document provided by the service.
         | 
| 8 7 | 
             
                  :wsdl => "http://www.thomas-bayer.com/axis2/services/BLZService?wsdl",
         | 
| 9 8 |  | 
| 10 9 | 
             
                  # Lower timeouts so these specs don't take forever when the service is not available.
         | 
| 11 10 | 
             
                  :open_timeout => 10,
         | 
| 12 11 | 
             
                  :read_timeout => 10,
         | 
| 13 12 |  | 
| 14 | 
            -
                  # Disable logging for cleaner spec output.
         | 
| 15 | 
            -
                  :log => false
         | 
| 13 | 
            +
                  :log => false # Disable logging for cleaner spec output.
         | 
| 16 14 | 
             
                )
         | 
| 17 15 |  | 
| 18 16 | 
             
                mutex = Mutex.new
         | 
| @@ -22,7 +20,7 @@ describe "ZIP code example" do | |
| 22 20 |  | 
| 23 21 | 
             
                threads = request_data.map do |blz|
         | 
| 24 22 | 
             
                  thread = Thread.new do
         | 
| 25 | 
            -
                    response = call_and_fail_gracefully | 
| 23 | 
            +
                    response = call_and_fail_gracefully(client, :get_bank, :message => { :blz => blz })
         | 
| 26 24 | 
             
                    Thread.current[:value] = response.body[:get_bank_response][:details]
         | 
| 27 25 | 
             
                    mutex.synchronize { threads_waiting -= 1 }
         | 
| 28 26 | 
             
                  end
         | 
| @@ -38,5 +36,4 @@ describe "ZIP code example" do | |
| 38 36 |  | 
| 39 37 | 
             
                expect(values.uniq.size).to eq(values.size)
         | 
| 40 38 | 
             
              end
         | 
| 41 | 
            -
             | 
| 42 39 | 
             
            end
         | 
    
        data/spec/savon/builder_spec.rb
    CHANGED
    
    
    
        data/spec/savon/client_spec.rb
    CHANGED
    
    | @@ -1,7 +1,8 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require "spec_helper"
         | 
| 2 3 | 
             
            require "integration/support/server"
         | 
| 3 4 |  | 
| 4 | 
            -
            describe Savon::Client do
         | 
| 5 | 
            +
            RSpec.describe Savon::Client do
         | 
| 5 6 |  | 
| 6 7 | 
             
              before :all do
         | 
| 7 8 | 
             
                @server = IntegrationServer.run
         | 
| @@ -231,15 +232,15 @@ describe Savon::Client do | |
| 231 232 | 
             
                end
         | 
| 232 233 |  | 
| 233 234 | 
             
                it "raises when the operation name is not a symbol" do
         | 
| 234 | 
            -
                  expect { new_client.build_request("not a symbol") }.to raise_error
         | 
| 235 | 
            +
                  expect { new_client.build_request("not a symbol") }.to raise_error ArgumentError
         | 
| 235 236 | 
             
                end
         | 
| 236 237 |  | 
| 237 238 | 
             
                it "raises when given an unknown option via the Hash syntax" do
         | 
| 238 | 
            -
                  expect { new_client.build_request(:authenticate, :invalid_local_option => true) }.to raise_error
         | 
| 239 | 
            +
                  expect { new_client.build_request(:authenticate, :invalid_local_option => true) }.to raise_error Savon::UnknownOptionError
         | 
| 239 240 | 
             
                end
         | 
| 240 241 |  | 
| 241 242 | 
             
                it "raises when given an unknown option via the block syntax" do
         | 
| 242 | 
            -
                  expect { new_client.build_request(:authenticate) { another_invalid_local_option true } }.to raise_error
         | 
| 243 | 
            +
                  expect { new_client.build_request(:authenticate) { another_invalid_local_option true } }.to raise_error Savon::UnknownOptionError
         | 
| 243 244 | 
             
                end
         | 
| 244 245 | 
             
              end
         | 
| 245 246 |  | 
| @@ -1,7 +1,9 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require "spec_helper"
         | 
| 2 3 |  | 
| 3 | 
            -
            describe Savon::HTTPError do
         | 
| 4 | 
            +
            RSpec.describe Savon::HTTPError do
         | 
| 4 5 | 
             
              let(:http_error) { Savon::HTTPError.new new_response(:code => 404, :body => "Not Found") }
         | 
| 6 | 
            +
              let(:http_error_with_empty_body) { Savon::HTTPError.new new_response(:code => 404, :body => "") }
         | 
| 5 7 | 
             
              let(:no_error) { Savon::HTTPError.new new_response }
         | 
| 6 8 |  | 
| 7 9 | 
             
              it "inherits from Savon::Error" do
         | 
| @@ -30,6 +32,12 @@ describe Savon::HTTPError do | |
| 30 32 | 
             
                  it "returns the HTTP error message" do
         | 
| 31 33 | 
             
                    expect(http_error.send method).to eq("HTTP error (404): Not Found")
         | 
| 32 34 | 
             
                  end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  context "when the body is empty" do
         | 
| 37 | 
            +
                    it "returns the HTTP error without the body message" do
         | 
| 38 | 
            +
                      expect(http_error_with_empty_body.send method).to eq("HTTP error (404)")
         | 
| 39 | 
            +
                    end
         | 
| 40 | 
            +
                  end
         | 
| 33 41 | 
             
                end
         | 
| 34 42 | 
             
              end
         | 
| 35 43 |  | 
    
        data/spec/savon/message_spec.rb
    CHANGED
    
    | @@ -1,7 +1,8 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require "spec_helper"
         | 
| 2 3 | 
             
            require "integration/support/server"
         | 
| 3 4 |  | 
| 4 | 
            -
            describe Savon::Message do
         | 
| 5 | 
            +
            RSpec.describe Savon::Message do
         | 
| 5 6 |  | 
| 6 7 | 
             
              before do
         | 
| 7 8 | 
             
                @server = IntegrationServer.run
         | 
| @@ -55,16 +56,6 @@ describe Savon::Message do | |
| 55 56 | 
             
                    end
         | 
| 56 57 | 
             
                  end
         | 
| 57 58 | 
             
                end
         | 
| 58 | 
            -
             | 
| 59 | 
            -
                context 'wsa:MessageID' do
         | 
| 60 | 
            -
                  let(:message_id_tag) {
         | 
| 61 | 
            -
                    '<wsa:MessageID xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">'
         | 
| 62 | 
            -
                  }
         | 
| 63 | 
            -
                  it 'should include xmlns:wsa attribute' do
         | 
| 64 | 
            -
                    response = client.call(:something, message: {})
         | 
| 65 | 
            -
                    expect(response.xml).to include(message_id_tag)
         | 
| 66 | 
            -
                  end
         | 
| 67 | 
            -
                end
         | 
| 68 59 | 
             
              end
         | 
| 69 60 |  | 
| 70 61 | 
             
            end
         | 
    
        data/spec/savon/mock_spec.rb
    CHANGED
    
    
    
        data/spec/savon/model_spec.rb
    CHANGED
    
    
| @@ -0,0 +1,46 @@ | |
| 1 | 
            +
            require "spec_helper"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            RSpec.describe Savon::Builder do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              let(:globals)     { Savon::GlobalOptions.new({ :endpoint => "http://example.co", :namespace => "http://v1.example.com" }) }
         | 
| 6 | 
            +
              let(:no_wsdl)     { Wasabi::Document.new }
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              it "building multipart request from inline content" do
         | 
| 9 | 
            +
                locals = {
         | 
| 10 | 
            +
                  attachments: [
         | 
| 11 | 
            +
                    { filename: 'x1.xml', content: '<xml>abc1</xml>'},
         | 
| 12 | 
            +
                    { filename: 'x2.xml', content: '<xml>abc2</xml>'},
         | 
| 13 | 
            +
                  ]
         | 
| 14 | 
            +
                }
         | 
| 15 | 
            +
                builder = Savon::Builder.new(:operation1, no_wsdl, globals, Savon::LocalOptions.new(locals))
         | 
| 16 | 
            +
                request_body = builder.to_s
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                expect(request_body).to include('Content-Type')
         | 
| 19 | 
            +
                expect(request_body).to match(/<[a-z]+:operation1>/)
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                locals[:attachments].each do |attachment|
         | 
| 22 | 
            +
                  expect(request_body).to match(/^Content-Location: #{attachment[:filename]}\s$/)
         | 
| 23 | 
            +
                  expect(request_body).to include(Base64.encode64(attachment[:content]).strip)
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              it "building multipart request from file" do
         | 
| 29 | 
            +
                locals = {
         | 
| 30 | 
            +
                  attachments: {
         | 
| 31 | 
            +
                    'file.gz' => File.expand_path("../../fixtures/gzip/message.gz", __FILE__)
         | 
| 32 | 
            +
                  }
         | 
| 33 | 
            +
                }
         | 
| 34 | 
            +
                builder = Savon::Builder.new(:operation1, no_wsdl, globals, Savon::LocalOptions.new(locals))
         | 
| 35 | 
            +
                request_body = builder.to_s
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                expect(request_body).to include('Content-Type')
         | 
| 38 | 
            +
                expect(request_body).to match(/<[a-z]+:operation1>/)
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                locals[:attachments].each do |id, file|
         | 
| 41 | 
            +
                  expect(request_body).to match(/^Content-Location: #{id}\s$/)
         | 
| 42 | 
            +
                  expect(request_body.gsub("\r", "")).to include(Base64.encode64(File.read(file)).strip)
         | 
| 43 | 
            +
                end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
              end
         | 
| 46 | 
            +
            end
         | 
| @@ -1,9 +1,10 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require "spec_helper"
         | 
| 2 3 | 
             
            require "integration/support/server"
         | 
| 3 4 | 
             
            require "json"
         | 
| 4 5 | 
             
            require "ostruct"
         | 
| 5 6 |  | 
| 6 | 
            -
            describe Savon::Operation do
         | 
| 7 | 
            +
            RSpec.describe Savon::Operation do
         | 
| 7 8 |  | 
| 8 9 | 
             
              let(:globals) { Savon::GlobalOptions.new(:endpoint => @server.url(:repeat), :log => false) }
         | 
| 9 10 | 
             
              let(:wsdl)    { Wasabi::Document.new Fixture.wsdl(:taxcloud) }
         | 
| @@ -108,7 +109,7 @@ describe Savon::Operation do | |
| 108 109 | 
             
                it "sets the Content-Length header" do
         | 
| 109 110 | 
             
                  # XXX: probably the worst spec ever written. refactor! [dh, 2013-01-05]
         | 
| 110 111 | 
             
                  http_request = HTTPI::Request.new
         | 
| 111 | 
            -
                  http_request.headers.expects(:[]=).with("Content-Length", " | 
| 112 | 
            +
                  http_request.headers.expects(:[]=).with("Content-Length", "723")
         | 
| 112 113 | 
             
                  Savon::SOAPRequest.any_instance.expects(:build).returns(http_request)
         | 
| 113 114 |  | 
| 114 115 | 
             
                  new_operation(:verify_address, wsdl, globals).call
         | 
| @@ -165,40 +166,28 @@ describe Savon::Operation do | |
| 165 166 | 
             
                  expect(actual_soap_action).to eq(%("authenticate"))
         | 
| 166 167 | 
             
                end
         | 
| 167 168 |  | 
| 168 | 
            -
                it " | 
| 169 | 
            -
                  globals.multipart | 
| 170 | 
            -
             | 
| 171 | 
            -
                   | 
| 172 | 
            -
                     | 
| 173 | 
            -
             | 
| 174 | 
            -
             | 
| 175 | 
            -
                     | 
| 169 | 
            +
                it "handle multipart response" do
         | 
| 170 | 
            +
                  globals.endpoint @server.url(:multipart)
         | 
| 171 | 
            +
                  operation = new_operation(:example, no_wsdl, globals)
         | 
| 172 | 
            +
                  response = operation.call do
         | 
| 173 | 
            +
                    attachments [
         | 
| 174 | 
            +
                      { filename: 'x1.xml', content: '<xml>abc</xml>'},
         | 
| 175 | 
            +
                      { filename: 'x2.xml', content: '<xml>cde</xml>'},
         | 
| 176 | 
            +
                    ]
         | 
| 176 177 | 
             
                  end
         | 
| 177 | 
            -
                end
         | 
| 178 | 
            -
             | 
| 179 | 
            -
                it "returns a Savon::Multipart::Response if available and requested locally" do
         | 
| 180 | 
            -
                  with_multipart_mocked do
         | 
| 181 | 
            -
                    operation = new_operation(:authenticate, no_wsdl, globals)
         | 
| 182 | 
            -
                    response = operation.call(:multipart => true)
         | 
| 183 178 |  | 
| 184 | 
            -
             | 
| 185 | 
            -
                   | 
| 179 | 
            +
                  expect(response.multipart?).to be true
         | 
| 180 | 
            +
                  expect(response.header).to eq 'response header'
         | 
| 181 | 
            +
                  expect(response.body).to eq 'response body'
         | 
| 182 | 
            +
                  expect(response.attachments.first.content_id).to eq 'attachment1'
         | 
| 186 183 | 
             
                end
         | 
| 187 184 |  | 
| 188 | 
            -
                it " | 
| 189 | 
            -
                  globals | 
| 190 | 
            -
             | 
| 191 | 
            -
                  operation = new_operation(:authenticate, no_wsdl, globals)
         | 
| 185 | 
            +
                it "simple request is not multipart" do
         | 
| 186 | 
            +
                  operation = new_operation(:example, no_wsdl, globals)
         | 
| 187 | 
            +
                  response = operation.call
         | 
| 192 188 |  | 
| 193 | 
            -
                  expect  | 
| 194 | 
            -
             | 
| 195 | 
            -
                end
         | 
| 196 | 
            -
             | 
| 197 | 
            -
                it "raises if savon-multipart is not available and it was requested locally" do
         | 
| 198 | 
            -
                  operation = new_operation(:authenticate, no_wsdl, globals)
         | 
| 199 | 
            -
             | 
| 200 | 
            -
                  expect { operation.call(:multipart => true) }.
         | 
| 201 | 
            -
                    to raise_error RuntimeError, /Unable to find Savon::Multipart/
         | 
| 189 | 
            +
                  expect(response.multipart?).to be false
         | 
| 190 | 
            +
                  expect(response.attachments).to be_empty
         | 
| 202 191 | 
             
                end
         | 
| 203 192 | 
             
              end
         | 
| 204 193 |  | 
| @@ -211,18 +200,6 @@ describe Savon::Operation do | |
| 211 200 | 
             
                end
         | 
| 212 201 | 
             
              end
         | 
| 213 202 |  | 
| 214 | 
            -
              def with_multipart_mocked
         | 
| 215 | 
            -
                multipart_response = Class.new { def initialize(*args); end }
         | 
| 216 | 
            -
                multipart_mock = Module.new
         | 
| 217 | 
            -
                multipart_mock.const_set('Response', multipart_response)
         | 
| 218 | 
            -
             | 
| 219 | 
            -
                Savon.const_set('Multipart', multipart_mock)
         | 
| 220 | 
            -
             | 
| 221 | 
            -
                yield
         | 
| 222 | 
            -
              ensure
         | 
| 223 | 
            -
                Savon.send(:remove_const, :Multipart) if Savon.const_defined? :Multipart
         | 
| 224 | 
            -
              end
         | 
| 225 | 
            -
             | 
| 226 203 | 
             
              def inspect_request(response)
         | 
| 227 204 | 
             
                hash = JSON.parse(response.http.body)
         | 
| 228 205 | 
             
                OpenStruct.new(hash)
         | 
    
        data/spec/savon/options_spec.rb
    CHANGED
    
    | @@ -1,10 +1,11 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require "spec_helper"
         | 
| 2 3 | 
             
            require "integration/support/server"
         | 
| 3 4 | 
             
            require "json"
         | 
| 4 5 | 
             
            require "ostruct"
         | 
| 5 6 | 
             
            require "logger"
         | 
| 6 7 |  | 
| 7 | 
            -
            describe "Options" do
         | 
| 8 | 
            +
            RSpec.describe "Options" do
         | 
| 8 9 |  | 
| 9 10 | 
             
              before :all do
         | 
| 10 11 | 
             
                @server = IntegrationServer.run
         | 
| @@ -398,6 +399,26 @@ describe "Options" do | |
| 398 399 | 
             
                end
         | 
| 399 400 | 
             
              end
         | 
| 400 401 |  | 
| 402 | 
            +
              context "global :log_headers" do
         | 
| 403 | 
            +
                it "instructs Savon to log SOAP requests and responses headers" do
         | 
| 404 | 
            +
                  stdout = mock_stdout {
         | 
| 405 | 
            +
                    client = new_client(:endpoint => @server.url, :log => true)
         | 
| 406 | 
            +
                    client.call(:authenticate)
         | 
| 407 | 
            +
                  }
         | 
| 408 | 
            +
                  soap_header = stdout.string.include? "Content-Type"
         | 
| 409 | 
            +
                  expect(soap_header).to be true
         | 
| 410 | 
            +
                end
         | 
| 411 | 
            +
             | 
| 412 | 
            +
                it "stops Savon from logging SOAP requests and responses headers" do
         | 
| 413 | 
            +
                  stdout = mock_stdout {
         | 
| 414 | 
            +
                    client = new_client(:endpoint => @server.url, :log => true, :log_headers => false)
         | 
| 415 | 
            +
                    client.call(:authenticate)
         | 
| 416 | 
            +
                  }
         | 
| 417 | 
            +
                  soap_header = stdout.string.include? "Content-Type"
         | 
| 418 | 
            +
                  expect(soap_header).to be false
         | 
| 419 | 
            +
                end
         | 
| 420 | 
            +
              end
         | 
| 421 | 
            +
             | 
| 401 422 | 
             
              context "global :ssl_version" do
         | 
| 402 423 | 
             
                it "sets the SSL version to use" do
         | 
| 403 424 | 
             
                  HTTPI::Auth::SSL.any_instance.expects(:ssl_version=).with(:TLSv1).twice
         | 
| @@ -407,6 +428,24 @@ describe "Options" do | |
| 407 428 | 
             
                end
         | 
| 408 429 | 
             
              end
         | 
| 409 430 |  | 
| 431 | 
            +
              context "global :ssl_min_version" do
         | 
| 432 | 
            +
                it "sets the SSL min_version to use" do
         | 
| 433 | 
            +
                  HTTPI::Auth::SSL.any_instance.expects(:min_version=).with(:TLS1_2).twice
         | 
| 434 | 
            +
             | 
| 435 | 
            +
                  client = new_client(:endpoint => @server.url, :ssl_min_version => :TLS1_2)
         | 
| 436 | 
            +
                  client.call(:authenticate)
         | 
| 437 | 
            +
                end
         | 
| 438 | 
            +
              end
         | 
| 439 | 
            +
             | 
| 440 | 
            +
              context "global :ssl_max_version" do
         | 
| 441 | 
            +
                it "sets the SSL max_version to use" do
         | 
| 442 | 
            +
                  HTTPI::Auth::SSL.any_instance.expects(:max_version=).with(:TLS1_2).twice
         | 
| 443 | 
            +
             | 
| 444 | 
            +
                  client = new_client(:endpoint => @server.url, :ssl_max_version => :TLS1_2)
         | 
| 445 | 
            +
                  client.call(:authenticate)
         | 
| 446 | 
            +
                end
         | 
| 447 | 
            +
              end
         | 
| 448 | 
            +
             | 
| 410 449 | 
             
              context "global :ssl_verify_mode" do
         | 
| 411 450 | 
             
                it "sets the verify mode to use" do
         | 
| 412 451 | 
             
                  HTTPI::Auth::SSL.any_instance.expects(:verify_mode=).with(:peer).twice
         | 
    
        data/spec/savon/request_spec.rb
    CHANGED
    
    | @@ -1,7 +1,8 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require "spec_helper"
         | 
| 2 3 | 
             
            require "integration/support/server"
         | 
| 3 4 |  | 
| 4 | 
            -
            describe Savon::WSDLRequest do
         | 
| 5 | 
            +
            RSpec.describe Savon::WSDLRequest do
         | 
| 5 6 |  | 
| 6 7 | 
             
              let(:globals)      { Savon::GlobalOptions.new }
         | 
| 7 8 | 
             
              let(:http_request) { HTTPI::Request.new }
         | 
| @@ -73,6 +74,20 @@ describe Savon::WSDLRequest do | |
| 73 74 | 
             
                  end
         | 
| 74 75 | 
             
                end
         | 
| 75 76 |  | 
| 77 | 
            +
                describe "write timeout" do
         | 
| 78 | 
            +
                  it "is set when specified" do
         | 
| 79 | 
            +
                    globals.write_timeout(44)
         | 
| 80 | 
            +
                    http_request.expects(:write_timeout=).with(44)
         | 
| 81 | 
            +
             | 
| 82 | 
            +
                    new_wsdl_request.build
         | 
| 83 | 
            +
                  end
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                  it "is not set otherwise" do
         | 
| 86 | 
            +
                    http_request.expects(:read_timeout=).never
         | 
| 87 | 
            +
                    new_wsdl_request.build
         | 
| 88 | 
            +
                  end
         | 
| 89 | 
            +
                end
         | 
| 90 | 
            +
             | 
| 76 91 | 
             
                describe "ssl version" do
         | 
| 77 92 | 
             
                  it "is set when specified" do
         | 
| 78 93 | 
             
                    globals.ssl_version(:TLSv1)
         | 
| @@ -87,6 +102,34 @@ describe Savon::WSDLRequest do | |
| 87 102 | 
             
                  end
         | 
| 88 103 | 
             
                end
         | 
| 89 104 |  | 
| 105 | 
            +
                describe "ssl min_version" do
         | 
| 106 | 
            +
                  it "is set when specified" do
         | 
| 107 | 
            +
                    globals.ssl_min_version(:TLS1_2)
         | 
| 108 | 
            +
                    http_request.auth.ssl.expects(:min_version=).with(:TLS1_2)
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                    new_wsdl_request.build
         | 
| 111 | 
            +
                  end
         | 
| 112 | 
            +
             | 
| 113 | 
            +
                  it "is not set otherwise" do
         | 
| 114 | 
            +
                    http_request.auth.ssl.expects(:min_version=).never
         | 
| 115 | 
            +
                    new_wsdl_request.build
         | 
| 116 | 
            +
                  end
         | 
| 117 | 
            +
                end
         | 
| 118 | 
            +
             | 
| 119 | 
            +
                describe "ssl max_version" do
         | 
| 120 | 
            +
                  it "is set when specified" do
         | 
| 121 | 
            +
                    globals.ssl_max_version(:TLS1_2)
         | 
| 122 | 
            +
                    http_request.auth.ssl.expects(:max_version=).with(:TLS1_2)
         | 
| 123 | 
            +
             | 
| 124 | 
            +
                    new_wsdl_request.build
         | 
| 125 | 
            +
                  end
         | 
| 126 | 
            +
             | 
| 127 | 
            +
                  it "is not set otherwise" do
         | 
| 128 | 
            +
                    http_request.auth.ssl.expects(:max_version=).never
         | 
| 129 | 
            +
                    new_wsdl_request.build
         | 
| 130 | 
            +
                  end
         | 
| 131 | 
            +
                end
         | 
| 132 | 
            +
             | 
| 90 133 | 
             
                describe "ssl verify mode" do
         | 
| 91 134 | 
             
                  it "is set when specified" do
         | 
| 92 135 | 
             
                    globals.ssl_verify_mode(:peer)
         | 
| @@ -148,6 +191,7 @@ describe Savon::WSDLRequest do | |
| 148 191 | 
             
                describe "ssl encrypted cert key file" do
         | 
| 149 192 | 
             
                  describe "set with an invalid decrypting password" do
         | 
| 150 193 | 
             
                    it "fails when attempting to use the SSL private key" do
         | 
| 194 | 
            +
                      skip("JRuby: find out why this does not raise an error!") if RUBY_PLATFORM == 'java'
         | 
| 151 195 | 
             
                      pass = "wrong-password"
         | 
| 152 196 | 
             
                      key  = File.expand_path("../../fixtures/ssl/client_encrypted_key.pem", __FILE__)
         | 
| 153 197 | 
             
                      cert = File.expand_path("../../fixtures/ssl/client_encrypted_key_cert.pem", __FILE__)
         | 
| @@ -158,15 +202,12 @@ describe Savon::WSDLRequest do | |
| 158 202 |  | 
| 159 203 | 
             
                      new_wsdl_request.build
         | 
| 160 204 |  | 
| 161 | 
            -
                      expect { http_request.auth.ssl.cert_key }.to raise_error
         | 
| 205 | 
            +
                      expect { http_request.auth.ssl.cert_key }.to raise_error OpenSSL::PKey::PKeyError
         | 
| 162 206 | 
             
                    end
         | 
| 163 207 | 
             
                  end
         | 
| 164 208 |  | 
| 165 209 | 
             
                  describe "set with a valid decrypting password" do
         | 
| 166 210 | 
             
                    it "handles SSL private keys properly" do
         | 
| 167 | 
            -
                      if RUBY_ENGINE == 'jruby'
         | 
| 168 | 
            -
                        pending("find out why this fails with a null pointer exception on jruby")
         | 
| 169 | 
            -
                      end
         | 
| 170 211 | 
             
                      pass = "secure-password!42"
         | 
| 171 212 | 
             
                      key  = File.expand_path("../../fixtures/ssl/client_encrypted_key.pem", __FILE__)
         | 
| 172 213 | 
             
                      cert = File.expand_path("../../fixtures/ssl/client_encrypted_key_cert.pem", __FILE__)
         | 
| @@ -257,7 +298,7 @@ describe Savon::WSDLRequest do | |
| 257 298 |  | 
| 258 299 | 
             
            end
         | 
| 259 300 |  | 
| 260 | 
            -
            describe Savon::SOAPRequest do
         | 
| 301 | 
            +
            RSpec.describe Savon::SOAPRequest do
         | 
| 261 302 |  | 
| 262 303 | 
             
              let(:globals)      { Savon::GlobalOptions.new }
         | 
| 263 304 | 
             
              let(:http_request) { HTTPI::Request.new }
         | 
    
        data/spec/savon/response_spec.rb
    CHANGED
    
    
| @@ -1,6 +1,7 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require "spec_helper"
         | 
| 2 3 |  | 
| 3 | 
            -
            describe Savon::SOAPFault do
         | 
| 4 | 
            +
            RSpec.describe Savon::SOAPFault do
         | 
| 4 5 | 
             
              let(:soap_fault) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault)), nori }
         | 
| 5 6 | 
             
              let(:empty_soap_fault) { Savon::SOAPFault.new new_response(:body => Fixture.response(:empty_soap_fault)), nori }
         | 
| 6 7 | 
             
              let(:soap_fault2) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault12)), nori }
         | 
| @@ -1,6 +1,7 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require "spec_helper"
         | 
| 2 3 |  | 
| 3 | 
            -
            describe Savon::Builder do
         | 
| 4 | 
            +
            RSpec.describe Savon::Builder do
         | 
| 4 5 |  | 
| 5 6 | 
             
              subject(:builder) { Savon::Builder.new(:create_object, wsdl, globals, locals) }
         | 
| 6 7 |  | 
| @@ -21,7 +22,7 @@ describe Savon::Builder do | |
| 21 22 |  | 
| 22 23 | 
             
                  locals = Savon::LocalOptions.new(message)
         | 
| 23 24 | 
             
                  builder = Savon::Builder.new(:create_object, wsdl, globals, locals)
         | 
| 24 | 
            -
                  expect(builder.to_s).to  | 
| 25 | 
            +
                  expect(builder.to_s).to include('<env:Envelope')
         | 
| 25 26 | 
             
                end
         | 
| 26 27 | 
             
              end
         | 
| 27 28 | 
             
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -1,11 +1,10 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require "bundler"
         | 
| 3 | 
            +
            require "byebug"
         | 
| 2 4 | 
             
            Bundler.setup(:default, :development)
         | 
| 3 5 |  | 
| 4 6 | 
             
            unless RUBY_PLATFORM =~ /java/
         | 
| 5 7 | 
             
              require "simplecov"
         | 
| 6 | 
            -
              require "coveralls"
         | 
| 7 | 
            -
             | 
| 8 | 
            -
              SimpleCov.formatter = Coveralls::SimpleCov::Formatter
         | 
| 9 8 | 
             
              SimpleCov.start do
         | 
| 10 9 | 
             
                  add_filter "spec"
         | 
| 11 10 | 
             
              end
         | 
| @@ -19,12 +18,14 @@ require "rspec" | |
| 19 18 | 
             
            require "httpclient"
         | 
| 20 19 |  | 
| 21 20 | 
             
            support_files = File.expand_path("spec/support/**/*.rb")
         | 
| 22 | 
            -
            Dir[support_files].each { |file| require file }
         | 
| 21 | 
            +
            Dir[support_files].sort.each { |file| require file }
         | 
| 23 22 |  | 
| 24 23 | 
             
            RSpec.configure do |config|
         | 
| 25 24 | 
             
              config.include SpecSupport
         | 
| 26 25 | 
             
              config.mock_with :mocha
         | 
| 27 26 | 
             
              config.order = "random"
         | 
| 27 | 
            +
              config.example_status_persistence_file_path = ".rspec_status"
         | 
| 28 | 
            +
              config.disable_monkey_patching!
         | 
| 28 29 | 
             
            end
         | 
| 29 30 |  | 
| 30 31 | 
             
            HTTPI.log = false
         | 
    
        data/spec/support/adapters.rb
    CHANGED
    
    
    
        data/spec/support/endpoint.rb
    CHANGED
    
    
    
        data/spec/support/fixture.rb
    CHANGED
    
    
    
        data/spec/support/integration.rb
    CHANGED