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

- old
+ new

@@ -14,11 +14,11 @@ end SemanticLogger::LEVELS.each do |level| it "send #{level}" do request = nil - @appender.http.stub(:request, -> r { request = r; response_mock.new('200', 'ok') }) do + @appender.http.stub(:request, ->(r) { request = r; response_mock.new('200', 'ok') }) do @appender.send(level, @message) end hash = JSON.parse(request.body) assert_equal @message, hash['message'] assert_equal level.to_s, hash['level'] @@ -31,11 +31,11 @@ Uh oh rescue Exception => e exc = e end request = nil - @appender.http.stub(:request, -> r { request = r; response_mock.new('200', 'ok') }) do + @appender.http.stub(:request, ->(r) { request = r; response_mock.new('200', 'ok') }) do @appender.send(level, 'Reading File', exc) end hash = JSON.parse(request.body) assert 'Reading File', hash['message'] assert 'NameError', hash['exception']['name'] @@ -44,21 +44,20 @@ assert hash['exception']['stack_trace'].first.include?(__FILE__), hash['exception'] end it "send #{level} custom attributes" do request = nil - @appender.http.stub(:request, -> r { request = r; response_mock.new('200', 'ok') }) do - @appender.send(level, @message, {key1: 1, key2: 'a'}) + @appender.http.stub(:request, ->(r) { request = r; response_mock.new('200', 'ok') }) do + @appender.send(level, @message, key1: 1, key2: 'a') end hash = JSON.parse(request.body) 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