diff --git a/spec/rubyspec/core/string/casecmp_spec.rb b/spec/rubyspec/core/string/casecmp_spec.rb index 6bfb66e039..fdb888ff2b 100644 --- a/spec/rubyspec/core/string/casecmp_spec.rb +++ b/spec/rubyspec/core/string/casecmp_spec.rb @@ -25,8 +25,16 @@ describe "String#casecmp independent of case" do "abc".casecmp(other).should == 0 end - it "raises a TypeError if other can't be converted to a string" do - lambda { "abc".casecmp(mock('abc')) }.should raise_error(TypeError) + ruby_version_is ""..."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 describe "in UTF-8 mode" do