Sha256: aff8ae68554d7f660d3678582b8070d9573c901c0e5f30984dabcc7c49efac6d

Contents?: true

Size: 897 Bytes

Versions: 31

Compression:

Stored size: 897 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

31 entries across 31 versions & 1 rubygems

Version Path
flapjack-0.6.53 features/steps/time_travel_steps.rb
flapjack-0.6.52 features/steps/time_travel_steps.rb
flapjack-0.6.51 features/steps/time_travel_steps.rb
flapjack-0.6.50 features/steps/time_travel_steps.rb
flapjack-0.6.49 features/steps/time_travel_steps.rb
flapjack-0.6.48 features/steps/time_travel_steps.rb
flapjack-0.6.47 features/steps/time_travel_steps.rb
flapjack-0.6.46 features/steps/time_travel_steps.rb
flapjack-0.6.45 features/steps/time_travel_steps.rb
flapjack-0.6.44 features/steps/time_travel_steps.rb
flapjack-0.6.43 features/steps/time_travel_steps.rb
flapjack-0.6.42 features/steps/time_travel_steps.rb
flapjack-0.6.41 features/steps/time_travel_steps.rb
flapjack-0.6.40 features/steps/time_travel_steps.rb
flapjack-0.6.39 features/steps/time_travel_steps.rb
flapjack-0.6.38 features/steps/time_travel_steps.rb
flapjack-0.6.37 features/steps/time_travel_steps.rb
flapjack-0.6.36 features/steps/time_travel_steps.rb
flapjack-0.6.35 features/steps/time_travel_steps.rb
flapjack-0.6.34 features/steps/time_travel_steps.rb