1require_relative '../../spec_helper' 2require 'date' 3 4describe "Date#<=>" do 5 it "returns 0 when two dates are equal" do 6 (Date.civil(2000, 04, 06) <=> Date.civil(2000, 04, 06)).should == 0 7 end 8 9 it "returns -1 when self is less than another date" do 10 (Date.civil(2000, 04, 05) <=> Date.civil(2000, 04, 06)).should == -1 11 end 12 13 it "returns -1 when self is less than a Numeric" do 14 (Date.civil(2000, 04, 05) <=> Date.civil(2000, 04, 06).jd).should == -1 15 end 16 17 it "returns 1 when self is greater than another date" do 18 (Date.civil(2001, 04, 05) <=> Date.civil(2000, 04, 06)).should == 1 19 end 20 21 it "returns 1 when self is greater than a Numeric" do 22 (Date.civil(2001, 04, 05) <=> Date.civil(2000, 04, 06).jd).should == 1 23 end 24end 25