diff options
author | Genadi Samokovarov <gsamokovarov@gmail.com> | 2018-12-29 17:27:33 +0200 |
---|---|---|
committer | Genadi Samokovarov <gsamokovarov@gmail.com> | 2019-04-19 14:15:22 +0900 |
commit | a3110fe20bc418034332bd01165df7fe6f20258e (patch) | |
tree | 2bbddbe477f6078d1d75f9614c40953dc4ad09a6 /activesupport/test | |
parent | 54df392bc51dcf424f07ccc10157a5969256ba73 (diff) | |
download | rails-a3110fe20bc418034332bd01165df7fe6f20258e.tar.gz rails-a3110fe20bc418034332bd01165df7fe6f20258e.tar.bz2 rails-a3110fe20bc418034332bd01165df7fe6f20258e.zip |
Drop the ambiguous `ActiveSupport::ActionableError#===` check
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/actionable_error_test.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/activesupport/test/actionable_error_test.rb b/activesupport/test/actionable_error_test.rb index 66ba94e0dd..80614b4700 100644 --- a/activesupport/test/actionable_error_test.rb +++ b/activesupport/test/actionable_error_test.rb @@ -4,8 +4,7 @@ require "abstract_unit" require "active_support/actionable_error" class ActionableErrorTest < ActiveSupport::TestCase - class NonActionableError < StandardError - end + NonActionableError = Class.new(StandardError) class DispatchableError < StandardError include ActiveSupport::ActionableError @@ -22,15 +21,23 @@ class ActionableErrorTest < ActiveSupport::TestCase end end - test "can get all action of an actionable error" do + test "lists all action of an actionable error" do assert_equal ["Flip 1", "Flip 2"], ActiveSupport::ActionableError.actions(DispatchableError).keys assert_equal ["Flip 1", "Flip 2"], ActiveSupport::ActionableError.actions(DispatchableError.new).keys end - test "cannot get actions from non-actionable errors" do + test "raises an error when trying to get actions from non-actionable error classes" do assert_raises ActiveSupport::ActionableError::NonActionable do ActiveSupport::ActionableError.actions(NonActionableError) end + + assert_raises ActiveSupport::ActionableError::NonActionable do + ActiveSupport::ActionableError.actions(NonActionableError.name) + end + end + + test "returns no actions from non-actionable exception instances" do + assert ActiveSupport::ActionableError.actions(Exception.new).empty? end test "dispatches actions from class and a label" do |