Sha256: 1825f055a4447f26f9d78c73997672731a6923135a946c192124a7bc216a9a1e

Contents?: true

Size: 1.19 KB

Versions: 15

Compression:

Stored size: 1.19 KB

Contents

# encoding: utf-8
require "spec_helper"
require "dev_flow/date_name"

describe DateName do
  describe ".zh" do
    it "can handle yesterday" do
      DateName.zh(DateTime.now-1).should eq('昨天')
    end

    it "can handle next two days" do
      DateName.zh(DateTime.now+2).should eq('后天')
    end

    it "can handle next two days" do
      DateName.zh(DateTime.now+6, DateTime.now+4).should eq('后天')
    end
    
    it "can handle next 6 days" do
      DateName.zh(DateTime.now+6).should eq('6天后')
    end
    
    it "can handle 8 days before" do
      DateName.zh(DateTime.now-6).should eq('6天前')
    end

    it "can handle next 14 days" do
      DateName.zh(DateTime.parse("2012-1-14"), DateTime.parse("2012-1-1")).should eq('01月14日')
    end
    
    it "can handle before 11 days on last year" do
      DateName.zh(DateTime.parse("2011-12-20"), DateTime.parse("2012-1-1")).should eq('2011年12月20日')
    end
    
    it "can handle today" do
      DateName.zh('2013/04/12', '2013/04/12').should eq('今天')
    end

    it "can handle tomorrow" do
      DateName.zh('2013/04/13', '2013/04/12').should eq('明天')
    end

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dev_flow-0.6.2 spec/date_name_spec.rb
dev_flow-0.6.1 spec/date_name_spec.rb
dev_flow-0.6.0 spec/date_name_spec.rb
dev_flow-0.5.5 spec/date_name_spec.rb
dev_flow-0.5.4 spec/date_name_spec.rb
dev_flow-0.5.3 spec/date_name_spec.rb
dev_flow-0.5.2 spec/date_name_spec.rb
dev_flow-0.5.1 spec/date_name_spec.rb
dev_flow-0.5.0 spec/date_name_spec.rb
dev_flow-0.4.2 spec/date_name_spec.rb
dev_flow-0.4.1 spec/date_name_spec.rb
dev_flow-0.4.0 spec/date_name_spec.rb
dev_flow-0.3.1 spec/date_name_spec.rb
dev_flow-0.3.0 spec/date_name_spec.rb
dev_flow-0.2.4 spec/date_name_spec.rb