module TimecopHarness

Public Instance Methods

current_time() click to toggle source
# File lib/cucumber/sammies/step_definitions/time_steps.rb, line 23
def current_time
  if use_timezones?
    Time.current
  else
    Time.now
  end
end
parse_time(str) click to toggle source
# File lib/cucumber/sammies/step_definitions/time_steps.rb, line 15
def parse_time(str)
  if use_timezones?
    Time.zone.parse(str)
  else
    Time.parse(str)
  end
end
use_timezones?() click to toggle source

When you have to make your rails app time zone aware you have to go 100% otherwise you are better off ignoring time zones at all. makandracards.com/makandra/8723-guide-to-localizing-a-rails-application

# File lib/cucumber/sammies/step_definitions/time_steps.rb, line 10
def use_timezones?
  active_record_loaded = defined?(ActiveRecord::Base)
  (!active_record_loaded || ActiveRecord::Base.default_timezone != :local) && Time.zone
end