1 require File.dirname(__FILE__) + "/../spec_helper"
7 describe LocalTime, "when included in a class" do
8 it "should add the adjust_time instance method to the class" do
9 MockTime.new.should respond_to(:adjust_time)
13 describe LocalTime, "when adjusting the time to local" do
16 @conf = Radiant::Config
20 it "should not change the time when no timezone is specified" do
21 @obj.adjust_time(@time).should == @time
24 it "should not change the time when an invalid timezone is specified" do
25 @conf["local.timezone"] = "Timezone that doesn't exist"
26 @obj.adjust_time(@time).should == @time
29 it "should properly adjust the time when a numeric offset is specified" do
31 @conf["local.timezone"] = offset
32 @obj.adjust_time(@time).should == @time + offset
35 it "should properly adjust the time when a named timezone is specified" do
36 offset = 9.hours # Tokyo
37 @conf["local.timezone"] = "Tokyo"
38 @obj.adjust_time(@time).should == @time + offset