Created
September 22, 2008 16:31
-
-
Save febuiles/12041 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/../../spec_helper' | |
require File.dirname(__FILE__) + '/fixtures/methods' | |
describe "Time#_dump" do | |
before :each do | |
@t = Time.local(2000, 1, 15, 20, 1, 1) | |
@s = @t._dump | |
end | |
it "dumps a Time object to a bytestring" do | |
@s.should be_kind_of(String) | |
@s.should == [2149122561, 68157440].pack("LL") | |
end | |
it "dumps an array with a date as first element" do | |
high = 1 << 31 | | |
(@t.year - 1900) << 14 | | |
(@t.mon - 1) << 10 | | |
@t.mday << 5 | | |
@t.hour | |
high.should == @s.unpack("LL").first | |
end | |
it "dumps an array with a time as second element" do | |
low = @t.min << 26 | | |
@t.sec << 20 | | |
@t.usec | |
low.should == @s.unpack("LL").last | |
end | |
end | |
$ !! | |
msr _dump_spec.rb | |
ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-darwin9.4.0] | |
.F. | |
1) | |
Time#_dump dumps an array with a date as first element FAILED | |
Expected 2149122548 | |
to equal 2149122561 | |
./_dump_spec.rb:21 | |
./_dump_spec.rb:2:in `all?' | |
./_dump_spec.rb:4 | |
Finished in 0.004545 seconds | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment