Sha256: 25597a34510d0656192ec7305838a9e129afb730460dd8fd133445413759b2e5

Contents?: true

Size: 804 Bytes

Versions: 4

Compression:

Stored size: 804 Bytes

Contents

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

describe "Kronos from_hash" do
  
  it "2002" do
    k = Kronos.from_hash({
      'year' => 2002,
    })
    k.year.should == 2002
    k.month.should == nil
    k.day.should == nil
  end

  it "November 2002" do
    k = Kronos.from_hash({
      'year' => 2002,
      'month' => 11,
    })
    k.year.should == 2002
    k.month.should == 11
    k.day.should == nil
  end

  it "November 9, 2002" do
    k = Kronos.from_hash({
      'year' => 2002,
      'month' => 11,
      'day'   => 9,
    })
    k.year.should == 2002
    k.month.should == 11
    k.day.should == 9
  end
  
  it "Malformed: ? 9, 2002" do
    k = Kronos.from_hash({
      'year' => 2002,
      'month' => nil,
      'day'   => 9,
    })
    k.should == nil
  end  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kronos-0.1.8 spec/from_hash_spec.rb
kronos-0.1.7 spec/from_hash_spec.rb
kronos-0.1.6 spec/from_hash_spec.rb
kronos-0.1.5 spec/from_hash_spec.rb