diff options
author | Jeremy Evans <[email protected]> | 2020-07-18 08:18:39 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2020-11-13 07:06:13 -0800 |
commit | ce9beb9d20187c861462282460b998684759e5e7 (patch) | |
tree | cb20c96125ee71ee3335bf15a8feefd370074d31 /spec | |
parent | 6d05967468ea58ba481259718f07b3cb5a386945 (diff) |
Improve error message when subclassing non-Class
Fixes [Bug #14726]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3330
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/core/class/new_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/language/class_spec.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/spec/ruby/core/class/new_spec.rb b/spec/ruby/core/class/new_spec.rb index f863766c1a..93152a83ee 100644 --- a/spec/ruby/core/class/new_spec.rb +++ b/spec/ruby/core/class/new_spec.rb @@ -95,7 +95,7 @@ describe "Class.new" do end it "raises a TypeError when given a non-Class" do - error_msg = /superclass must be a Class/ + error_msg = /superclass must be a.*Class/ -> { Class.new("") }.should raise_error(TypeError, error_msg) -> { Class.new(1) }.should raise_error(TypeError, error_msg) -> { Class.new(:symbol) }.should raise_error(TypeError, error_msg) diff --git a/spec/ruby/language/class_spec.rb b/spec/ruby/language/class_spec.rb index fa30e22c3a..83db164e1a 100644 --- a/spec/ruby/language/class_spec.rb +++ b/spec/ruby/language/class_spec.rb @@ -286,7 +286,7 @@ describe "A class definition extending an object (sclass)" do end it "raises a TypeError when trying to extend non-Class" do - error_msg = /superclass must be a Class/ + error_msg = /superclass must be a.* Class/ -> { class TestClass < ""; end }.should raise_error(TypeError, error_msg) -> { class TestClass < 1; end }.should raise_error(TypeError, error_msg) -> { class TestClass < :symbol; end }.should raise_error(TypeError, error_msg) |