Sha256: 5d8e0c58ab07921f8a36d79dcebe6f2eee9b674c9d59555cefee3170e869dff2

Contents?: true

Size: 1.07 KB

Versions: 27

Compression:

Stored size: 1.07 KB

Contents

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

module ICU
  describe Util do
    context "#parsedate" do
      it "should parse standard dates" do
        Util.parsedate('2001-01-01').should == '2001-01-01'
        Util.parsedate('1955-11-09').should == '1955-11-09'
      end
      
      it "should handle US format" do
        Util.parsedate('03/30/2009').should == '2009-03-30'
      end
      
      it "should handle European format" do
        Util.parsedate('30/03/2009').should == '2009-03-30'
      end
            
      it "should prefer European format" do
        Util.parsedate('02/03/2009').should == '2009-03-02'
      end
      
      it "should handle US style when there's no alternative" do
        Util.parsedate('02/23/2009').should == '2009-02-23'
      end

      it "should handle single digits" do
        Util.parsedate('9/8/2006').should == '2006-08-09'
      end
      
      it "should handle names of months" do
        Util.parsedate('9th Nov 1955').should == '1955-11-09'
        Util.parsedate('16th June 1986').should == '1986-06-16'
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
sanichi-chess_icu-0.2.10 spec/util_spec.rb
sanichi-chess_icu-0.2.5 spec/util_spec.rb
sanichi-chess_icu-0.2.6 spec/util_spec.rb
sanichi-chess_icu-0.2.7 spec/util_spec.rb
sanichi-chess_icu-0.2.8 spec/util_spec.rb
sanichi-chess_icu-0.2.9 spec/util_spec.rb
sanichi-chess_icu-0.3.0 spec/util_spec.rb
sanichi-chess_icu-0.3.1 spec/util_spec.rb
sanichi-chess_icu-0.3.2 spec/util_spec.rb
sanichi-chess_icu-0.3.3 spec/util_spec.rb
sanichi-chess_icu-0.3.4 spec/util_spec.rb
sanichi-chess_icu-0.3.5 spec/util_spec.rb
sanichi-chess_icu-0.4.0 spec/util_spec.rb
sanichi-chess_icu-0.4.1 spec/util_spec.rb
sanichi-chess_icu-0.4.10 spec/util_spec.rb
sanichi-chess_icu-0.4.2 spec/util_spec.rb
sanichi-chess_icu-0.4.3 spec/util_spec.rb
sanichi-chess_icu-0.4.4 spec/util_spec.rb
sanichi-chess_icu-0.4.5 spec/util_spec.rb
sanichi-chess_icu-0.4.6 spec/util_spec.rb