title: Rails time formatting test failing because it's one hour off?
body: <p>I have the following method in one of my Rails classes:</p>
  
  <pre><code>def human_departure_time
    "#{departure_time.strftime("%A, %d %B %Y")} at #{departure_time.strftime("%I:%M %p")}"
  end
  </code></pre>
  
  <p>As you can see, it just takes a <code>datetime</code> attribute of the model and formats it so that it is more human friendly.</p>
  
  <p>Anyway, I have the following test for this method:</p>
  
  <pre><code>describe "human_departure_time" do
    it "should output the time in readable format" do
      # first I use the Timecop gem to freeze the time
      Timecop.freeze(DateTime.now) do
        bus_time = DateTime.now + 1.days
        # factory a bus with a specific departure time
        bus = Factory :bus, departure_time: bus_time
        expected = "#{bus_time.strftime("%A, %d %B %Y")} at #{bus_time.strftime("%I:%M %p")}"
        # check that the output is as expected
        bus.human_departure_time.should == expected
      end
    end
  end
  </code></pre>
  
  <p>Pretty simple but the test fails by one hour with the following output:</p>
  
  <pre><code>Failures:
  
    1) Bus human_departure_time should output the time in readable format
       Failure/Error: bus.human_departure_time.should == expected
         expected: "Wednesday, 17 August 2011 at 03:13 AM"
              got: "Wednesday, 17 August 2011 at 02:13 AM" (using ==)
       # ./spec/models/bus_spec.rb:34:in `block (4 levels) in &lt;top (required)&gt;'
       # ./spec/models/bus_spec.rb:30:in `block (3 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>Here is my bus factory just incase that is important. I'm overwriting the departure time with the frozen time plus one hour in my test.</p>
  
  <pre><code>factory :bus do
    origin_name "Drogheda"
    event_name "EP"
    departure_time { DateTime.now + 14.days }
  end
  </code></pre>
  
  <p>I assume this is something to do with daylight savings time or something? How can I fix this issue?</p>