test/appender/tcp_test.rb in semantic_logger-4.2.0 vs test/appender/tcp_test.rb in semantic_logger-4.2.1

- old
+ new

@@ -17,11 +17,11 @@ end SemanticLogger::LEVELS.each do |level| it "send #{level}" do data = nil - @appender.tcp_client.stub(:write, -> d { data = d }) do + @appender.tcp_client.stub(:write, ->(d) { data = d }) do @appender.send(level, @message) end hash = JSON.parse(data) assert_equal @message, hash['message'] assert_equal level.to_s, hash['level'] @@ -34,11 +34,11 @@ Uh oh rescue Exception => e exc = e end data = nil - @appender.tcp_client.stub(:write, -> d { data = d }) do + @appender.tcp_client.stub(:write, ->(d) { data = d }) do @appender.send(level, 'Reading File', exc) end hash = JSON.parse(data) assert 'Reading File', hash['message'] assert 'NameError', hash['exception']['name'] @@ -47,21 +47,20 @@ assert hash['exception']['stack_trace'].first.include?(__FILE__), hash['exception'] end it "send #{level} custom attributes" do data = nil - @appender.tcp_client.stub(:write, -> d { data = d }) do - @appender.send(level, @message, {key1: 1, key2: 'a'}) + @appender.tcp_client.stub(:write, ->(d) { data = d }) do + @appender.send(level, @message, key1: 1, key2: 'a') end hash = JSON.parse(data) assert_equal @message, hash['message'] assert_equal level.to_s, hash['level'] refute hash['stack_trace'] assert payload = hash['payload'], hash assert_equal 1, payload['key1'], payload assert_equal 'a', payload['key2'], payload end - end end end end