Sha256: bf8722da5f28c0dc3fb666f2a8333e670b0ece65cdbf66aa633aae0cbb56f190
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' describe 'Rack request logger with Sinatra', timecop: true do let(:io) { StringIO.new } before do Loga.reset Loga.configure do |config| config.service_name = 'hello_world_app' config.service_version = '1.0' config.filter_parameters = [:password] config.device = io end Loga.initialize! end let(:json) do io.rewind JSON.parse(io.read) end let(:app) do Class.new(Sinatra::Base) do # Disable show_exceptions and rely on user defined exception handlers # (e.i. the error blocks) set :show_exceptions, false use Loga::Rack::RequestId use Loga::Rack::Logger, Loga.logger, [:uuid, 'TEST_TAG'] error do status 500 body 'Ooops' end get '/ok' do 'Hello Sinatra' end get '/error' do nil.name end post '/users' do content_type :json params.to_json end get '/new' do redirect '/ok' end end end include_examples 'request logger' it 'does not include the controller name and action' do get '/ok' expect(json).to_not include('_request.controller') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
loga-1.4.0 | spec/integration/sinatra_spec.rb |