te7cag
Last Updated: February 25, 2016
·
1.183K
· descentintomael
C8326f8f8ec51f2a1e5eb5d5fa6e4f33

Time traveling in cucumber

Using the following step, I can use ActiveSupport's time helpers and Timecop to travel around in time.

When /^wait (\d+) (\w+)$/ do |time_amount, time_units|
  Timecop.travel time_amount.send(time_units.to_sym)
end

With this, I can write steps like "And wait 2 hours" to test things like expiration dates and timeouts.

Say Thanks
Respond

1 Response
Add your response

14933
B322b431b97c9259afaec3ac55a4b3bf

Exactly what I needed! Thank you!

over 1 year ago ·