Sha256: ea7a84654b7baf30edb0ddac59ccd78cdcf758dd2dd495e5c73638be7f66b244

Contents?: true

Size: 716 Bytes

Versions: 3

Compression:

Stored size: 716 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
  
  it "nothing is invalid" do
    new_kronos(nil, nil, nil).valid?.should == false
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kronos-0.1.8 spec/valid_spec.rb
kronos-0.1.7 spec/valid_spec.rb
kronos-0.1.6 spec/valid_spec.rb