aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/string/casecmp_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/casecmp_spec.rb')
-rw-r--r--spec/ruby/core/string/casecmp_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/ruby/core/string/casecmp_spec.rb b/spec/ruby/core/string/casecmp_spec.rb
index c77d97815c..f556c79346 100644
--- a/spec/ruby/core/string/casecmp_spec.rb
+++ b/spec/ruby/core/string/casecmp_spec.rb
@@ -180,5 +180,17 @@ ruby_version_is "2.4" do
end
end
end
+
+ ruby_version_is "2.4" ... "2.5" do
+ it "raises a TypeError if other can't be converted to a string" do
+ lambda { "abc".casecmp?(mock('abc')) }.should raise_error(TypeError)
+ end
+ end
+
+ ruby_version_is "2.5" do
+ it "returns nil if other can't be converted to a string" do
+ "abc".casecmp?(mock('abc')).should be_nil
+ end
+ end
end
end