Sha256: 88ba8ec6ce2706263f1e0346ca317946260b141b7b84b118ea9b4f6dbdc68bd0

Contents?: true

Size: 873 Bytes

Versions: 5

Compression:

Stored size: 873 Bytes

Contents

require 'spec_helper'
require 'partial-date'

describe PartialDate::Date do

  let(:date) { PartialDate::Date.new }

  describe "to string" do
    it "should be fast" do
      date.year = 2012; date.month = 12; date.day = 1
      puts date.to_s 
    end

    it "should not have a dash at the end if day is missing" do
      date.year = 2012; date.month = 12; date.day = 0
      puts date.to_s 
    end

    it "it should not have a trailing dash if month and day are missing" do
      date.year = 2012; date.month = 0; date.day = 0
      puts date.to_s 
    end

    it "it should not have a leading dash if year is missing" do
      date.year = 0; date.month = 12; date.day = 1
      puts date.to_s 
    end

    it "it should preserve the minus sign if year is negative" do
      date.year = -1000; date.month = 12; date.day = 1
      puts date.to_s 
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
partial-date-1.2.3 spec/to_s_spec.rb
partial-date-1.2.2 spec/to_s_spec.rb
partial-date-1.2.1 spec/to_s_spec.rb
partial-date-1.2.0 spec/to_s_spec.rb
partial-date-1.1.10 spec/to_s_spec.rb