1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
* Specs added by TruffleRuby.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2018-06-13 21:58:54 +00:00
parent 5b55eaa00d
commit b46da8d84e
24 changed files with 812 additions and 57 deletions

View file

@ -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