From b46da8d84efeb97cb52ba0560d5b149ccda0d561 Mon Sep 17 00:00:00 2001 From: eregon Date: Wed, 13 Jun 2018 21:58:54 +0000 Subject: Update to ruby/spec@4bb0f25 * Specs added by TruffleRuby. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- spec/ruby/core/time/comparison_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/ruby/core/time/comparison_spec.rb') diff --git a/spec/ruby/core/time/comparison_spec.rb b/spec/ruby/core/time/comparison_spec.rb index 44d8778da4..5b53c9fb50 100644 --- a/spec/ruby/core/time/comparison_spec.rb +++ b/spec/ruby/core/time/comparison_spec.rb @@ -45,6 +45,16 @@ describe "Time#<=>" do (Time.at(100, 0) <=> Time.at(100, Rational(1,1000))).should == -1 end + it "returns nil when compared to an Integer because Time does not respond to #coerce" do + time = Time.at(1) + time.respond_to?(:coerce).should == false + time.should_receive(:respond_to?).exactly(2).and_return(false) + -> { + (time <=> 2).should == nil + (2 <=> time).should == nil + }.should_not complain + end + describe "given a non-Time argument" do it "returns nil if argument <=> self returns nil" do t = Time.now -- cgit v1.2.3