spec/timber/logger_spec.rb in timber-2.0.24 vs spec/timber/logger_spec.rb in timber-2.1.0.rc1

- old
+ new

@@ -8,12 +8,12 @@ around(:each) do |example| Timecop.freeze(time) { example.run } end - context "with the StringFormatter" do - before(:each) { logger.formatter = Timber::Logger::StringFormatter.new } + context "with the AugmentedFormatter" do + before(:each) { logger.formatter = Timber::Logger::AugmentedFormatter.new } it "should accept strings" do logger.info("this is a test") expect(io.string).to start_with("this is a test @metadata {\"level\":\"info\",\"dt\":\"2016-09-01T12:00:00.000000Z\"") end @@ -89,11 +89,11 @@ logger.info "first\nsecond" expect(io.string).to start_with("first\\nsecond @metadata") end end - context "with the :json format" do + context "with the JSONFormatter" do before(:each) { logger.formatter = Timber::Logger::JSONFormatter.new } it "should log in the correct format" do logger.info("this is a test") expect(io.string).to start_with("{\"level\":\"info\",\"dt\":\"2016-09-01T12:00:00.000000Z\",\"message\":\"this is a test\"") @@ -127,22 +127,22 @@ describe "#with_context" do let(:io) { StringIO.new } let(:logger) { Timber::Logger.new(io) } it "should add context" do - expect(Timber::CurrentContext.hash).to eq({}) + expect(Timber::CurrentContext.instance.send(:hash)).to eq({}) logger.with_context(build: {version: "1.0.0"}) do - expect(Timber::CurrentContext.hash).to eq({:custom=>{:build=>{:version=>"1.0.0"}}}) + expect(Timber::CurrentContext.instance.send(:hash)).to eq({:custom=>{:build=>{:version=>"1.0.0"}}}) logger.with_context({testing: {key: "value"}}) do - expect(Timber::CurrentContext.hash).to eq({:custom=>{:build=>{:version=>"1.0.0"}, :testing=>{:key=>"value"}}}) + expect(Timber::CurrentContext.instance.send(:hash)).to eq({:custom=>{:build=>{:version=>"1.0.0"}, :testing=>{:key=>"value"}}}) end - expect(Timber::CurrentContext.hash).to eq({:custom=>{:build=>{:version=>"1.0.0"}}}) + expect(Timber::CurrentContext.instance.send(:hash)).to eq({:custom=>{:build=>{:version=>"1.0.0"}}}) end - expect(Timber::CurrentContext.hash).to eq({}) + expect(Timber::CurrentContext.instance.send(:hash)).to eq({}) end end describe "#info" do let(:io) { StringIO.new } \ No newline at end of file