Sha256: 35c47eb7120e42ddd030497782b69bc9cbc61a0ea51625a394db290abb63e089

Contents?: true

Size: 1.46 KB

Versions: 52

Compression:

Stored size: 1.46 KB

Contents

require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/methods', __FILE__)

describe "Time#_load" do
  ruby_bug("http://redmine.ruby-lang.org/issues/show/627", "1.8.7") do
    it "loads a time object in the new format" do
      t = Time.local(2000, 1, 15, 20, 1, 1)
      t = t.gmtime

      high =               1 << 31 |
            (t.gmt? ? 1 : 0) << 30 |
             (t.year - 1900) << 14 |
                (t.mon  - 1) << 10 |
                       t.mday << 5 |
                            t.hour

      low =  t.min  << 26 |
             t.sec  << 20 |
                   t.usec

      Time._load([high, low].pack("VV")).should == t
    end
  end

  it "loads a time object in the old UNIX timestamp based format" do
    t = Time.local(2000, 1, 15, 20, 1, 1, 203)
    timestamp = t.to_i

    high = timestamp & ((1 << 31) - 1)

    low =  t.usec

    Time._load([high, low].pack("VV")).should == t
  end

  ruby_version_is ''...'1.9' do
    it "loads MRI's marshaled time format" do
      t = Marshal.load("\004\bu:\tTime\r\320\246\e\200\320\001\r\347")
      t.utc

      t.to_s.should == "Fri Oct 22 16:57:48 UTC 2010"
    end
  end

  ruby_version_is '1.9' do
    it "loads MRI's marshaled time format" do
      t = Marshal.load("\004\bu:\tTime\r\320\246\e\200\320\001\r\347")
      t.utc

      t.to_s.should == "2010-10-22 16:57:48 UTC"
    end
  end
end

describe "Time._load" do
  it "needs to be reviewed for spec completeness"
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-7.5.1 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-7.4.1 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-7.1.17 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-6.2.0 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-6.0.11 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-5.5.18 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-5.5.17 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-5.5.15 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-5.5.2 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-5.5.0 spec/framework_spec/app/spec/core/time/_load_spec.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/core/time/_load_spec.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/core/time/_load_spec.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.3.5 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.4.2 spec/framework_spec/app/spec/core/time/_load_spec.rb