spec/datetime/strftime_spec.rb in third_base-1.1.1 vs spec/datetime/strftime_spec.rb in third_base-1.2.0

- old
+ new

@@ -50,23 +50,24 @@ it "should be able to print the number of seconds since the unix epoch" do DateTime.civil(2008, 11, 12, 14, 3, 30, 0, -28800).strftime('%s').should == "1226527410" DateTime.civil(2008, 11, 12, 14, 3, 31, 0, -28800).strftime('%s').should == "1226527411" end - it "should be able to print the time zone offset as a Z if the offset is zero" do - DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%Z').should == "Z" + it "should be able to print the time zone offset as a string of hours and minutes" do + DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%z').should == "+0000" + DateTime.civil(2000, 4, 6, 10, 11, 12, 0, -43200).strftime('%z').should == "-1200" + DateTime.civil(2000, 4, 6, 10, 11, 12, 0, 43200).strftime('%z').should == "+1200" + DateTime.civil(2000, 4, 6, 10, 11, 12, 0, -3600).strftime('%z').should == "-0100" + DateTime.civil(2000, 4, 6, 10, 11, 12, 0, 3600).strftime('%z').should == "+0100" + + DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%Z').should == "+00:00" DateTime.civil(2000, 4, 6, 10, 11, 12, 0, -43200).strftime('%Z').should == "-12:00" + DateTime.civil(2000, 4, 6, 10, 11, 12, 0, 43200).strftime('%Z').should == "+12:00" + DateTime.civil(2000, 4, 6, 10, 11, 12, 0, -3600).strftime('%Z').should == "-01:00" + DateTime.civil(2000, 4, 6, 10, 11, 12, 0, 3600).strftime('%Z').should == "+01:00" end - it "should be able to print the time zone offset as a string of hours and minutes" do - DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%z').should == "+00:00" - DateTime.civil(2000, 4, 6, 10, 11, 12, 0, -43200).strftime('%z').should == "-12:00" - DateTime.civil(2000, 4, 6, 10, 11, 12, 0, 43200).strftime('%z').should == "+12:00" - DateTime.civil(2000, 4, 6, 10, 11, 12, 0, -3600).strftime('%z').should == "-01:00" - DateTime.civil(2000, 4, 6, 10, 11, 12, 0, 3600).strftime('%z').should == "+01:00" - end - ############################ # Specs that combine stuff # ############################ it "should be able to print the common date" do @@ -95,8 +96,8 @@ end it "should be able to print the common date and timezone" do DateTime.civil(2000, 4, 6, 10, 11, 12).strftime("%+").should == "Thu Apr 6 10:11:12 +00:00 2000" DateTime.civil(2000, 4, 6, 10, 11, 12, 0, 43200).strftime("%+").should == "Thu Apr 6 10:11:12 +12:00 2000" - DateTime.civil(2000, 4, 6, 10, 11, 12).strftime("%+").should == DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%a %b %e %H:%M:%S %z %Y') + DateTime.civil(2000, 4, 6, 10, 11, 12).strftime("%+").should == DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%a %b %e %H:%M:%S %Z %Y') end end