Skip to content

Instantly share code, notes, and snippets.

@antico5
Created January 3, 2017 14:24
Show Gist options
  • Save antico5/4c570cabfe04c76fb037811fbedb3ffa to your computer and use it in GitHub Desktop.
Save antico5/4c570cabfe04c76fb037811fbedb3ffa to your computer and use it in GitHub Desktop.
time travel
require 'rails_helper'
include ActiveSupport::Testing::TimeHelpers
describe TimeTravel do
it 'allows person to answer after 1 day' do
expect(person_can_answer).to be_falsey
# About to go to the future
travel(1.day) do
# While in the future
expect(person_can_answer).to be_truthy
end
# Back to reality
expect(person_can_answer).to be_falsey
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment