Sha256: e3582bf7bec71049d7a5ce21e745ef2ab980ff75fe74b989b2eef650a9923fc9

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

require 'spec_helper'

describe TimeZoneExt do
  before(:each) do
    Time.zone = 'EST'
  end

  it "parses time with timezone specified by name" do
    Time.zone.strptime("2012-06-02 00:00 UTC", "%Y-%m-%d %H:%M %Z").to_s.should == "2012-06-01 19:00:00 -0500"
  end

  it "parses time with timezone specified by offset" do
    Time.zone.strptime("2012-06-02 00:00 +0100", "%Y-%m-%d %H:%M %z").to_s.should == "2012-06-01 18:00:00 -0500"
  end

  it "parses time without explicitly specified timezone" do
    Time.zone.strptime("2012-06-02 00:00", "%Y-%m-%d %H:%M").to_s.should == "2012-06-02 00:00:00 -0500"
  end

  it "parses time with named time zone" do
    Time.zone = "Moscow"
    Time.zone.strptime("2012-06-02 00:00", "%Y-%m-%d %H:%M").to_s.should == "2012-06-02 00:00:00 +0400"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
time_zone_ext-0.0.3 spec/time_zone_ext_spec.rb