spec/parser_spec.rb in validates_timeliness-2.3.1 vs spec/parser_spec.rb in validates_timeliness-2.3.2
- old
+ new
@@ -5,10 +5,14 @@
describe "parse" do
it "should return time object for valid time string" do
parse("2000-01-01 12:13:14", :datetime).should be_kind_of(Time)
end
+
+ it "should return Time object for ISO 8601 string with time zone" do
+ parse("2000-01-01T12:23:42+09:00", :datetime).should be_kind_of(Time)
+ end
it "should return nil for time string with invalid date part" do
parse("2000-02-30 12:13:14", :datetime).should be_nil
end
@@ -17,15 +21,15 @@
end
it "should return Time object when passed a Time object" do
parse(Time.now, :datetime).should be_kind_of(Time)
end
-
+
if RAILS_VER >= '2.1'
it "should convert time string into current timezone" do
Time.zone = 'Melbourne'
- time = parse("2000-01-01 12:13:14", :datetime)
- Time.zone.utc_offset.should == 10.hours
+ time = parse("2000-06-01 12:13:14", :datetime)
+ time.utc_offset.should == 10.hours
end
end
it "should return nil for invalid date string" do
parse("2000-02-30", :date).should be_nil