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

- old
+ new

@@ -11,38 +11,37 @@ end SemanticLogger::LEVELS.each do |level| it "sends #{level} message" do error_message = hash = nil - Raven.stub(:capture_message, -> msg, h { error_message = msg; hash = h }) do + Raven.stub(:capture_message, ->(msg, h) { error_message = msg; hash = h }) do @appender.send(level, @message) end assert_equal @message, error_message assert_equal 'SemanticLogger::Appender::Sentry', hash[:extra][:name] - if [:error, :fatal].include?(level) - assert hash[:extra].has_key?(:backtrace) + if %i[error fatal].include?(level) + assert hash[:extra].key?(:backtrace) else - refute hash[:extra].has_key?(:backtrace) + refute hash[:extra].key?(:backtrace) end - assert_equal true, hash.has_key?(:extra) + assert_equal true, hash.key?(:extra) assert_equal level, hash[:level] end it "sends #{level} exceptions" do error = RuntimeError.new('Oh no, Error.') exception = hash = nil - Raven.stub(:capture_exception, -> exc, h { exception = exc; hash = h }) do + Raven.stub(:capture_exception, ->(exc, h) { exception = exc; hash = h }) do @appender.send(level, @message, error) end assert_equal error.class.to_s, exception.class.to_s assert_equal error.message, exception.message - assert_equal true, hash.has_key?(:extra) + assert_equal true, hash.key?(:extra) assert_equal @message, hash[:extra][:message], hash assert_equal level, hash[:level] end end - end end end