Sha256: 55c29b83ae1cb36a31b84849c02c0441ede3f7a17e34fb1579483ea22b80c4db

Contents?: true

Size: 915 Bytes

Versions: 10

Compression:

Stored size: 915 Bytes

Contents

require File.expand_path('../../helper', __FILE__)
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

10 entries across 10 versions & 2 rubygems

Version Path
whos_dated_who-0.1.0 vendor/bundle/gems/faraday-0.9.0/test/adapters/logger_test.rb
whos_dated_who-0.0.1 vendor/bundle/gems/faraday-0.9.0/test/adapters/logger_test.rb
faraday-0.9.0 test/adapters/logger_test.rb
faraday-0.9.0.rc7 test/adapters/logger_test.rb
faraday-0.9.0.rc6 test/adapters/logger_test.rb
faraday-0.9.0.rc5 test/adapters/logger_test.rb
faraday-0.9.0.rc4 test/adapters/logger_test.rb
faraday-0.9.0.rc3 test/adapters/logger_test.rb
faraday-0.9.0.rc2 test/adapters/logger_test.rb
faraday-0.9.0.rc1 test/adapters/logger_test.rb