Merge pull request #3190 from riking/thrown_logging

Delete old ErrorLog, use Logster for 500 errors
This commit is contained in:
Sam
2015-02-23 14:19:16 +11:00
16 changed files with 47 additions and 176 deletions

View File

@ -1,58 +0,0 @@
require 'spec_helper'
describe ErrorLog do
def boom
raise "boom"
end
def exception
begin
boom
rescue => e
return e
end
end
def controller
DraftController.new
end
def request
ActionController::TestRequest.new(host: 'test')
end
describe "add_row!" do
it "creates a non empty file on first call" do
ErrorLog.clear_all!
ErrorLog.add_row!(hello: "world")
expect(File.exists?(ErrorLog.filename)).to eq true
end
end
describe "logging data" do
it "is able to read the data it writes" do
ErrorLog.clear_all!
ErrorLog.report!(exception, controller, request, nil)
ErrorLog.report!(exception, controller, request, nil)
i = 0
ErrorLog.each do |h|
i += 1
end
expect(i).to eq 2
end
it "is able to skip rows" do
ErrorLog.clear_all!
ErrorLog.report!(exception, controller, request, nil)
ErrorLog.report!(exception, controller, request, nil)
ErrorLog.report!(exception, controller, request, nil)
ErrorLog.report!(exception, controller, request, nil)
i = 0
ErrorLog.skip(3) do |h|
i += 1
end
expect(i).to eq 1
end
end
end