Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Standup 08/08/2008

Sean Beckett
Friday, August 8, 2008

Interesting Things

  • When using time zones in Rails 2.1, if you specify a zone, any datetime ActiveRecord attributes will be returned in that zone. E.g. if you specify Eastern Time, and then later request changed_at from an ActiveRecord, it will be returned in ET. However, if you ask for Time.now it is always returned in the local time zone, regardless of TZ settings. This isn’t necessarily bad or unexpected behavior, but it can lead to test failures if you save a time to an ActiveRecord, get it back, and then compare the values. One workaround is to use Time.zone.now, which will always respect the current time zone, although this doesn’t help with large existing codebases.

Ask for Help

“We’re FlexMock for some of our Test::Unit unit tests, and recently added some new tests; nothing that is exercising new parts of the code or creating new mocks. However, for some reason when we call previously existing mocks we get errors from Rspec. These are not exceptions or assertion failures, but full-stop errors as if there were a syntax error. Turns out Rspec reopens the Test::Unit::TestCase class and overwrites some behavior, although the cause of the errors remain entirely unclear. Anyone know why it would do that and how to prevent it in the future?”

A few people mumbled about Rspec magic, but actual help was not immediately forthcoming.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

One comment

  1. Brian Takita says:

    What was the specific issue and stack trace?

    Rails also opens up Test::Unit::TestCase to add a Mocha specific hack, even if you dont use Mocha.

    August 11, 2008 at 5:57 am

Add New Comment Cancel reply

Your email address will not be published.

Sean Beckett

Sean Beckett
San Francisco

Recent Posts

  • New MBA plus Migration Assistant can lead to runaway Dock process
  • New Tech Talk: Parse
  • New Tech Talk: Travis
Subscribe to Sean's Feed

Author Topics

techtalk (44)
jobs (30)
gems (1)
movember (3)
meetup (2)
agile (8)
design (1)
rspec (1)
jsunit (1)
javascript (1)
selenium (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >