Sha256: 47fe4b868f8fd1490a53e46c49e986f38891c87de488cef79afbc7d58cee06bf

Contents?: true

Size: 555 Bytes

Versions: 7

Compression:

Stored size: 555 Bytes

Contents

require "refile/custom_logger"

describe Refile::CustomLogger do
  let(:rack_app) do
    ->(_) { [200, {}, ["Success"]] }
  end
  let(:io) { StringIO.new }
  let(:env) do
    { "QUERY_STRING" => "",
      "REQUEST_METHOD" => "POST",
      "PATH_INFO" => "/" }
  end

  let(:expected_format) { %r{Prefix: \[[^\]]+\] POST "/" 200 \d+\.\d+ms\n\n$} }

  it "uses a dynamic logger" do
    _, _, body = described_class.new(rack_app, "Prefix", -> { Logger.new(io) }).call(env)
    body.close
    expect(io.tap(&:rewind).read).to match(expected_format)
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
leifcr-refile-0.7.3 spec/refile/custom_logger_spec.rb
leifcr-refile-0.7.1 spec/refile/custom_logger_spec.rb
leifcr-refile-0.7.0 spec/refile/custom_logger_spec.rb
leifcr-refile-0.6.3 spec/refile/custom_logger_spec.rb
refile-0.6.2 spec/refile/custom_logger_spec.rb
refile-0.6.1 spec/refile/custom_logger_spec.rb
refile-0.6.0 spec/refile/custom_logger_spec.rb