test/appender/honeybadger_test.rb in semantic_logger-3.2.1 vs test/appender/honeybadger_test.rb in semantic_logger-3.3.0
- old
+ new
@@ -5,20 +5,26 @@
class HoneybadgerTest < Minitest::Test
describe SemanticLogger::Appender::Honeybadger do
before do
@appender = SemanticLogger::Appender::Honeybadger.new(:trace)
@message = 'AppenderHoneybadgerTest log message'
+ SemanticLogger.backtrace_level = :error
end
SemanticLogger::LEVELS.each do |level|
it "sends #{level} message" do
hash = nil
Honeybadger.stub(:notify, -> h { hash = h }) do
@appender.send(level, @message)
end
assert_equal @message, hash[:error_message]
assert_equal 'SemanticLogger::Appender::Honeybadger', hash[:error_class]
- assert_equal true, hash.has_key?(:backtrace)
+
+ if [:error, :fatal].include?(level)
+ assert hash.has_key?(:backtrace)
+ else
+ refute hash.has_key?(:backtrace)
+ end
assert_equal true, hash.has_key?(:context)
assert_equal level, hash[:context][:level]
end
it "sends #{level} exceptions" do