Renamed helpers to correspond to renamed Controller classes.
[merb_radiant.git] / radiant_specs / spec / lib / .svn / text-base / local_time_spec.rb.svn-base
blob56847785b9c338987ded5185a7e390583f808aa5
1 require File.dirname(__FILE__) + "/../spec_helper"
3 class MockTime
4   include LocalTime
5 end
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)
10   end
11 end
13 describe LocalTime, "when adjusting the time to local" do
14   before :each do
15     @obj = MockTime.new
16     @conf = Radiant::Config
17     @time = Time.gm 2004
18   end
19   
20   it "should not change the time when no timezone is specified" do
21     @obj.adjust_time(@time).should == @time
22   end
23   
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
27   end
28   
29   it "should properly adjust the time when a numeric offset is specified" do
30     offset = -10.hours
31     @conf["local.timezone"] = offset
32     @obj.adjust_time(@time).should == @time + offset
33   end
34   
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
39   end
40 end