spec/standalone/ucblit/logging/loggers_spec.rb in berkeley_library-logging-0.2.5 vs spec/standalone/ucblit/logging/loggers_spec.rb in berkeley_library-logging-0.2.6
- old
+ new
@@ -6,11 +6,11 @@
module Logging
describe Loggers do
attr_reader :out
# rubocop:disable Lint/ConstantDefinitionInBlock
- before(:each) do
+ before do
@out = StringIO.new
class ::TestError < StandardError
attr_writer :cause
def cause
@@ -18,11 +18,11 @@
end
end
end
# rubocop:enable Lint/ConstantDefinitionInBlock
- after(:each) do
+ after do
Object.send(:remove_const, :TestError)
end
describe :new_readable_logger do
it 'logs ANSI colors' do
@@ -37,11 +37,10 @@
end
describe :new_json_logger do
# TODO: rewrite this as a matcher
- # rubocop:disable Metrics/AbcSize
def assert_serialized_error(err_json, err)
expect(err_json).to be_a(Hash)
expect(err_json['name']).to eq(TestError.name)
expect(err_json['message']).to eq(err.message)
@@ -50,12 +49,10 @@
expect(backtrace).not_to be_nil # just to be sure
backtrace.each do |line|
expect(err_stack).to include(line)
end
end
- # rubocop:enable Metrics/AbcSize
-
it 'supports tagged logging' do
logger = Loggers.new_json_logger(out)
logger = ActiveSupport::TaggedLogging.new(logger)
expected_tag = 'hello'
@@ -327,14 +324,14 @@
end
describe :new_default_logger do
attr_reader :config
- before(:each) do
+ before do
@config = OpenStruct.new
end
- after(:each) do
+ after do
BerkeleyLibrary::Logging.instance_variable_set(:@env, nil)
end
it 'returns a readable $stdout logger if given no config' do
logger = Loggers.new_default_logger