diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-13 21:58:54 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-13 21:58:54 +0000 |
commit | b46da8d84efeb97cb52ba0560d5b149ccda0d561 (patch) | |
tree | 382ba848ef97215f1a5ec991727db3ed7f90973c /spec/ruby/core/time/comparison_spec.rb | |
parent | 5b55eaa00db05004d1a6b74c3aaa5e680fc73235 (diff) | |
download | ruby-b46da8d84efeb97cb52ba0560d5b149ccda0d561.tar.gz |
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
Diffstat (limited to 'spec/ruby/core/time/comparison_spec.rb')
-rw-r--r-- | spec/ruby/core/time/comparison_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
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 |