Sha256: 8727ca275727fb1408436c2a52fb39424555128fa95ca91d4e0b46540558a0bf

Contents?: true

Size: 833 Bytes

Versions: 9

Compression:

Stored size: 833 Bytes

Contents

require "spec_helper"

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

9 entries across 9 versions & 2 rubygems

Version Path
savon-2.12.1 spec/savon/request_logger_spec.rb
savon-2.12.0 spec/savon/request_logger_spec.rb
savon-2.11.2 spec/savon/request_logger_spec.rb
savon-SU-2.11.1b spec/savon/request_logger_spec.rb
savon-SU-2.11.1 spec/savon/request_logger_spec.rb
savon-2.11.1 spec/savon/request_logger_spec.rb
savon-2.11.0 spec/savon/request_logger_spec.rb
savon-2.10.1 spec/savon/request_logger_spec.rb
savon-2.10.0 spec/savon/request_logger_spec.rb