test/test_backtrace.rb in backtrace-0.1.0 vs test/test_backtrace.rb in backtrace-0.2.0
- old
+ new
@@ -35,6 +35,21 @@
rescue StandardError => e
text = Backtrace.new(e).to_s
assert(text.include?("RuntimeError: Just a test\n"), text)
assert(text.include?('test/test_backtrace.rb'), text)
end
+
+ def test_runs_a_block
+ log = FakeLog.new
+ Backtrace.exec(swallow: true, log: log) do
+ raise 'It is intended'
+ end
+ assert(log.sent.include?('intended'))
+ end
+
+ class FakeLog
+ attr_reader :sent
+ def error(msg)
+ @sent = msg
+ end
+ end
end