diff options
author | José Valim <jose.valim@gmail.com> | 2012-04-27 15:24:14 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-04-27 15:24:14 -0700 |
commit | d8c3ad73dd85d9e429264a9f43f8cca51f852275 (patch) | |
tree | 399724742a576eaa71250517a543406ad1d9b7bf /railties/test/queueing | |
parent | 3fc16a99dabefd79f4a09f0338e6b904968578e9 (diff) | |
parent | 4531ba74938985bd2343b27d1a30d099d5975b02 (diff) | |
download | rails-d8c3ad73dd85d9e429264a9f43f8cca51f852275.tar.gz rails-d8c3ad73dd85d9e429264a9f43f8cca51f852275.tar.bz2 rails-d8c3ad73dd85d9e429264a9f43f8cca51f852275.zip |
Merge pull request #6021 from sikachu/log_exception
Log the exception from the ThreadConsumer
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 |