diff options
author | Dieter Komendera <dieter@komendera.com> | 2014-12-09 10:55:58 +0100 |
---|---|---|
committer | Dieter Komendera <dieter@komendera.com> | 2014-12-10 22:13:13 +0100 |
commit | 2fde159f6b22fa45f132ba25c48eb3c371ead949 (patch) | |
tree | 0a75df25566bf19a0848711ea221051949f2cdbb /actionpack/test | |
parent | efe80bce9765f7fcc1d09338a212f8ea1c4d7a7a (diff) | |
download | rails-2fde159f6b22fa45f132ba25c48eb3c371ead949.tar.gz rails-2fde159f6b22fa45f132ba25c48eb3c371ead949.tar.bz2 rails-2fde159f6b22fa45f132ba25c48eb3c371ead949.zip |
Ensure append_info_to_payload is called even if an exception is raised.
See:
* https://github.com/rails/rails/pull/14903
* https://github.com/roidrage/lograge/issues/37
Some code by mxrguspxrt from #14903.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/log_subscriber_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/controller/log_subscriber_test.rb b/actionpack/test/controller/log_subscriber_test.rb index 49be7caf38..864c6ee130 100644 --- a/actionpack/test/controller/log_subscriber_test.rb +++ b/actionpack/test/controller/log_subscriber_test.rb @@ -73,6 +73,16 @@ module Another def with_action_not_found raise AbstractController::ActionNotFound end + + def append_info_to_payload(payload) + super + payload[:test_key] = "test_value" + @last_payload = payload + end + + def last_payload + @last_payload + end end end @@ -163,6 +173,16 @@ class ACLogSubscriberTest < ActionController::TestCase assert_match(/\(Views: [\d.]+ms\)/, logs[1]) end + def test_append_info_to_payload_is_called_even_with_exception + begin + get :with_exception + wait + rescue Exception + end + + assert_equal "test_value", @controller.last_payload[:test_key] + end + def test_process_action_with_filter_parameters @request.env["action_dispatch.parameter_filter"] = [:lifo, :amount] |