Sha256: 344c354a8593f8aa593f745c9a1a45a4abe4fa38cbc07a00104fc71a6ff23aa9

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

describe "Time" do

  describe "Caching the date formatter" do
    
    it "should reuse the created formatter" do
      100.times do
        Time.iso8601("2011-04-11T13:22:21Z")
      end

      Thread.current[:date_formatters].count.should.equal 1
      Thread.current[:date_formatters]["yyyy-MM-dd'T'HH:mm:ss'Z'"].should.not.equal nil
    end

  end


  describe "parsing an iso8601 formatted time to a Time object" do
    before do
      @time = Time.iso8601("2012-05-31T19:41:33Z")
    end

    it "should be a time" do
      @time.instance_of?(Time).should == true
    end

    # # Crashes Buggy RubyMotion 1.18
    # it "should be converted to the local timezone automatically" do
    #   @time.zone.should == Time.now.zone
    # end

    it "should have a valid year" do
      @time.utc.year.should == 2012
    end

    it "should have a valid month" do
      @time.utc.month.should == 5
    end

    it "should have a valid day" do
      @time.utc.day.should == 31
    end

    it "should have a valid hour" do
      @time.utc.hour.should == 19
    end

    it "should have a valid minute" do
      @time.utc.min.should == 41
    end

    it "should have a valid second" do
      @time.utc.sec.should == 33
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bubble-wrap-1.3.0 spec/motion/core/time_spec.rb
bubble-wrap-1.3.0.osx spec/motion/core/time_spec.rb
bubble-wrap-1.2.0 spec/motion/core/time_spec.rb
bubble-wrap-1.2.0.pre spec/motion/core/time_spec.rb
bubble-wrap-1.1.5 spec/motion/core/time_spec.rb
bubble-wrap-1.1.4 spec/motion/core/time_spec.rb
bubble-wrap-1.1.3 spec/motion/core/time_spec.rb
bubble-wrap-1.1.2 spec/motion/core/time_spec.rb
bubble-wrap-1.1.1 spec/motion/core/time_spec.rb