Sha256: d724de4e2d8fbf25bb57d6cd90300a7f3bb689f2d6295860f771f6af2aa5008c

Contents?: true

Size: 905 Bytes

Versions: 8

Compression:

Stored size: 905 Bytes

Contents

#!/usr/bin/env ruby

require 'delorean'
require 'chronic'

When /^(.+) passes$/ do |time|
  period = Chronic.parse("#{time} from now")
  Delorean.time_travel_to(period)
  # puts "Time Travelled to #{Time.now.to_s}"
end

Given /^I time travel to (.+)$/ do |period|
  Delorean.time_travel_to(period)
  # puts "Time Travelled to #{Time.now.to_s}"
end

Given /^I come back to the present$/ do
  Delorean.back_to_the_present
  # puts "Time Travelled to the present, #{Time.now.to_s}"
end

Given /^I time travel in (.+) to (.+)$/ do |zone_name, timestamp|
  zone = ::Time.find_zone!(zone_name)
  time = zone.parse timestamp
  Delorean.time_travel_to time
  # puts "Time Travelled to #{Time.now.to_s}"
end

Then /^the time in UTC should be about (.+)$/ do |timestamp|
  actual = Time.now.in_time_zone('UTC')
  expected = Time.parse("#{timestamp} UTC")
  (expected..expected+5).cover?(actual).should be_true
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
flapjack-0.6.61 features/steps/time_travel_steps.rb
flapjack-0.6.60 features/steps/time_travel_steps.rb
flapjack-0.6.59 features/steps/time_travel_steps.rb
flapjack-0.6.58 features/steps/time_travel_steps.rb
flapjack-0.6.57 features/steps/time_travel_steps.rb
flapjack-0.6.56 features/steps/time_travel_steps.rb
flapjack-0.6.55 features/steps/time_travel_steps.rb
flapjack-0.6.54 features/steps/time_travel_steps.rb