Sha256: 0ce309c80d04b6e883d8c38bd388c3b0de45a9374daab3890c532a7606baf68e

Contents?: true

Size: 940 Bytes

Versions: 15

Compression:

Stored size: 940 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'helper'))
require 'stringio'
require 'logger'

module Adapters
  class LoggerTest < Faraday::TestCase
    def setup
      @io     = StringIO.new
      @logger = Logger.new(@io)
      @logger.level = Logger::DEBUG

      @conn = Faraday.new do |b|
        b.response :logger, @logger
        b.adapter :test do |stubs|
          stubs.get('/hello') { [200, {'Content-Type' => 'text/html'}, 'hello'] }
        end
      end
      @resp = @conn.get '/hello', nil, :accept => 'text/html'
    end

    def test_still_returns_output
      assert_equal 'hello', @resp.body
    end

    def test_logs_method_and_url
      assert_match "get http:/hello", @io.string
    end

    def test_logs_request_headers
      assert_match %(Accept: "text/html), @io.string
    end

    def test_logs_response_headers
      assert_match %(Content-Type: "text/html), @io.string
    end
  end
end

Version data entries

15 entries across 15 versions & 4 rubygems

Version Path
faraday-0.8.11 test/adapters/logger_test.rb
faraday-0.8.10 test/adapters/logger_test.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/faraday-0.8.9/test/adapters/logger_test.rb
faraday-0.8.9 test/adapters/logger_test.rb
faraday-0.8.8 test/adapters/logger_test.rb
faraday-0.8.7 test/adapters/logger_test.rb
vagrant-actionio-0.0.9 vendor/bundle/gems/faraday-0.8.6/test/adapters/logger_test.rb
faraday-0.8.6 test/adapters/logger_test.rb
faraday-0.8.5 test/adapters/logger_test.rb
faraday-0.8.4 test/adapters/logger_test.rb
faraday-0.8.2 test/adapters/logger_test.rb
avdi-faraday-0.8.1 test/adapters/logger_test.rb
faraday-0.8.1 test/adapters/logger_test.rb
faraday-0.8.0 test/adapters/logger_test.rb
faraday-0.8.0.rc2 test/adapters/logger_test.rb