Last Updated: February 25, 2016
· descentintomael

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| time_amount.send(time_units.to_sym)

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

1 Response
Add your response

Exactly what I needed! Thank you!

over 1 year ago ·