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.
Written by Sean Todd
Related protips
1 Response
Exactly what I needed! Thank you!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#