summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--class.c2
-rw-r--r--spec/ruby/core/class/new_spec.rb2
-rw-r--r--spec/ruby/language/class_spec.rb2
-rw-r--r--vm_insnhelper.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/class.c b/class.c
index 4b8130d4ec..7cc087f182 100644
--- a/class.c
+++ b/class.c
@@ -227,7 +227,7 @@ void
rb_check_inheritable(VALUE super)
{
if (!RB_TYPE_P(super, T_CLASS)) {
- rb_raise(rb_eTypeError, "superclass must be a Class (%"PRIsVALUE" given)",
+ rb_raise(rb_eTypeError, "superclass must be an instance of Class (given an instance of %"PRIsVALUE")",
rb_obj_class(super));
}
if (RBASIC(super)->flags & FL_SINGLETON) {
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)
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 74e992a500..2fa96373b6 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -4068,7 +4068,7 @@ vm_define_class(ID id, rb_num_t flags, VALUE cbase, VALUE super)
if (VM_DEFINECLASS_HAS_SUPERCLASS_P(flags) && !RB_TYPE_P(super, T_CLASS)) {
rb_raise(rb_eTypeError,
- "superclass must be a Class (%"PRIsVALUE" given)",
+ "superclass must be an instance of Class (given an instance of %"PRIsVALUE")",
rb_obj_class(super));
}