Sha256: fcdb508caf513cf5665505fdf8afd43ec11dba02cdc2843804b6ceac4315e0d0
Contents?: true
Size: 938 Bytes
Versions: 2
Compression:
Stored size: 938 Bytes
Contents
require 'rack/test' require 'rack/logs' describe 'accessing an individual log', type: :integration do include Rack::Test::Methods let(:app) do Rack::Builder.app do logs = Rack::Logs.configure do |config| config.log_dir = './tmp' end run logs end end before do File.open('./tmp/my_log_file.log','w') do |f| f.write "LOG ENTRY 1234" end File.open('./tmp/other_file.log','w') do |f| f.write "LOG ENTRY 5678" end get '/my_log_file.log' end example 'returns a 200 response code' do expect(last_response).to be_ok end example 'accessing the log returns only the specific log contents' do expect(last_response.body).to match 'LOG ENTRY 1234' expect(last_response.body).to_not match 'LOG ENTRY 5678' end example 'cross path traversal is prevented' do get "/../tmp/secret_file.txt" expect(last_response.status).to be 404 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack-logs-0.0.5 | spec/integration/accessing_an_individual_log_spec.rb |
rack-logs-0.0.4 | spec/integration/accessing_an_individual_log_spec.rb |