Sha256: c189c7d70eb9f7ea22a8e255ab9cdf15f002f1ae68518ea284ced6474490c423

Contents?: true

Size: 625 Bytes

Versions: 2

Compression:

Stored size: 625 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Kronos Comparisons" do
  
  def new_kronos(year=nil, month=nil, day=nil)
    k = Kronos.new
    k.year  = year if year
    k.month = month if month
    k.day   = day if day
    k
  end
  
  it "year only is valid" do
    new_kronos(2005).valid?.should == true
  end

  it "month and year is valid" do
    new_kronos(2005, 8).valid?.should == true
  end

  it "month, day, and year is valid" do
    new_kronos(2005, 8, 22).valid?.should == true
  end

  it "day and year is invalid" do
    new_kronos(2005, nil, 22).valid?.should == false
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kronos-0.1.5 spec/valid_spec.rb
kronos-0.1.4 spec/valid_spec.rb