2 require File.dirname(__FILE__) + '/../../spec_helper'
3 require File.dirname(__FILE__) + '/shared/civil'
5 describe "Date#civil" do
7 it_behaves_like(:date_civil, :civil)
11 describe "Date#valid_civil?" do
13 it "should be able to determine if a date is valid" do
14 Date.valid_civil?(1582, 10, 14).should == nil
15 Date.valid_civil?(1582, 10, 15).should == Date.civil(1582, 10, 15).jd
16 Date.valid_civil?(1582, 10, 14, Date::ENGLAND).should_not == nil
17 Date.valid_civil?(1582, 10, 14, Date::ENGLAND).should == Date.civil(1582, 10, 14, Date::ENGLAND).jd
20 it "should be able to handle negative months and days" do
21 Date.valid_civil?(1582, -3, -18).should == nil
22 Date.valid_civil?(1582, -3, -17).should == Date.civil(1582, 10, 15).jd
24 Date.valid_civil?(2007, -11, -10).should == Date.civil(2007, 2, 19).jd
25 Date.valid_civil?(2008, -11, -10).should == Date.civil(2008, 2, 20).jd