Created
August 2, 2010 07:08
-
-
Save ngty/504251 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# instead of Time.now (or watever class methods of Time), we use: | |
LocalTime.now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When %r{I press "([^"]*)" at "([^"]*)"$} do |button, timing| | |
LocalTime.xstub(:now => LocalTime.parse(timing)) | |
When %|I press "#{button}"| | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LocalTime | |
@@zone = Time.zone | |
class << self | |
def method_missing(method, *args) | |
args.empty? ? @@zone.send(method) : @@zone.send(method, *args) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails::Initializer.run do |config| | |
# lots of other stuff | |
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. | |
# Run "rake -D time" for a list of tasks for finding time zone names. | |
config.time_zone = 'Singapore' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment