Sha256: fd0679eaa60c9cac28af99824edd00cd8dc1ed3a6af1733b35f780ff02f4777c

Contents?: true

Size: 869 Bytes

Versions: 2

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

RSpec.describe Savon::RequestLogger do

  subject            { described_class.new(globals) }
  let(:globals)      { Savon::GlobalOptions.new(:log => true, :pretty_print_xml => true) }
  let(:request) {
    stub('Request',
         :url     => 'http://example.com',
         :headers => [],
         :body    => '<TestRequest />'
        )
  }

  let(:response) {
    stub('Response',
         :code => 200,
         :body => '<TestResponse />'
        )
  }

  before(:each) {
    globals[:logger].level = Logger::DEBUG
  }

  describe '#log_request / #log_response' do
    it 'does not prepare log messages when no logging is needed' do
      begin
        globals[:logger].level = Logger::FATAL

        Savon::LogMessage.expects(:new).never
        subject.log(request) { response }
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
savon-2.13.1 spec/savon/request_logger_spec.rb
savon-2.13.0 spec/savon/request_logger_spec.rb