2 require File.dirname(__FILE__) + '/../../spec_helper'
6 it "should add a number of days to a Date" do
7 d = Date.civil(2007,2,27) + 10
8 d.should == Date.civil(2007, 3, 9)
11 it "should add a negative number of days to a Date" do
12 d = Date.civil(2007,2,27).+(-10)
13 d.should == Date.civil(2007, 2, 17)
16 it "should raise an error on non numeric parameters" do
17 lambda { Date.civil(2007,2,27) + :hello }.should raise_error(TypeError)
18 lambda { Date.civil(2007,2,27) + "hello" }.should raise_error(TypeError)
19 lambda { Date.civil(2007,2,27) + Date.new }.should raise_error(TypeError)
20 lambda { Date.civil(2007,2,27) + Object.new }.should raise_error(TypeError)