Sha256: aa3413ed4805b3dfd5ed42b692c1b701e3f264aaa6e677bcffeecb3b5285d89c

Contents?: true

Size: 930 Bytes

Versions: 2

Compression:

Stored size: 930 Bytes

Contents

require 'rack/test'
require 'rack/logs'

describe 'running `Rack::Logs` via `Rack::Builder`', type: :integration do
  include Rack::Test::Methods

  context 'running with defaults' do
    let(:app) { Rack::Builder.app { run Rack::Logs } }

    before { get '/' }

    example 'returns a 404 response code because there are no files' do
      expect(last_response.status).to eq 404
    end
  end

  context 'given a log in a configured directory' do
    let(:app) do
      log_dir = support_path('fixtures/log')
      Rack::Builder.app do
        logs = Rack::Logs.configure do |config|
          config.log_dir = log_dir
        end
        run logs
      end
    end

    before do
      get '/'
    end

    example 'returns a 200 response code' do
      expect(last_response).to be_ok
    end

    example 'accessing the log returns log contents' do
      expect(last_response.body).to match 'LOG ENTRY 1234'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-logs-0.1.0 spec/integration/running_rack_logs_via_rack_spec.rb
rack-logs-0.0.6 spec/integration/running_rack_logs_via_rack_spec.rb