diff options
Diffstat (limited to 'railties/test/queueing')
-rw-r--r-- | railties/test/queueing/threaded_consumer_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/railties/test/queueing/threaded_consumer_test.rb b/railties/test/queueing/threaded_consumer_test.rb index d00a67d511..8e31ebf3c7 100644 --- a/railties/test/queueing/threaded_consumer_test.rb +++ b/railties/test/queueing/threaded_consumer_test.rb @@ -62,4 +62,20 @@ class TestThreadConsumer < ActiveSupport::TestCase assert_equal true, ran end + + test "log job that raises an exception" do + require "active_support/log_subscriber/test_helper" + logger = ActiveSupport::LogSubscriber::TestHelper::MockLogger.new + Rails.logger = logger + + job = Job.new(1) do + raise "RuntimeError: Error!" + end + + @queue.push job + sleep 0.1 + + assert_equal 1, logger.logged(:error).size + assert_match /Job Error: RuntimeError: Error!/, logger.logged(:error).last + end end |