Sha256: 7df1155ae4ad8f7a124c67eab97c60337eef6c6c2651ff776ea7a58b89b9c9ad
Contents?: true
Size: 1.28 KB
Versions: 6
Compression:
Stored size: 1.28 KB
Contents
require(File.join(File.dirname(__FILE__), '..', 'date_spec_helper')) describe :date_civil, :shared => true do it "creates a date with arguments" do d = Date.send(@method, 2000, 3, 5) d.year.should == 2000 d.month.should == 3 d.day.should == 5 d.jd.should == 2451609 # Should also work with years far in the past and future d = Date.send(@method, -9000, 7, 5) d.year.should == -9000 d.month.should == 7 d.day.should == 5 d.jd.should == -1565937 d = Date.send(@method, 9000, 10, 14) d.year.should == 9000 d.month.should == 10 d.day.should == 14 d.jd.should == 5008529 end it "doesn't create dates for invalid arguments" do lambda { Date.send(@method, 2000, 13, 31) }.should raise_error(ArgumentError) lambda { Date.send(@method, 2000, 12, 32) }.should raise_error(ArgumentError) lambda { Date.send(@method, 2000, 2, 30) }.should raise_error(ArgumentError) lambda { Date.send(@method, 1900, 2, 29) }.should raise_error(ArgumentError) lambda { Date.send(@method, 2000, 2, 29) }.should_not raise_error(ArgumentError) end end describe "Date#civil" do it_behaves_like(:date_civil, :civil) end describe "Date#new" do it_behaves_like(:date_civil, :new) end
Version data entries
6 entries across 6 versions & 1 rubygems