Skip to content

Instantly share code, notes, and snippets.

@aks
Created March 12, 2020 17:11
Rspec shared_context to freeze time
FREEZE_DATETIME = '2020/02/20 10:20:30 GMT'
shared_context 'freeze_time' do
around do |example|
Timecop.freeze(FREEZE_DATETIME)
example.run
Timecop.return
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment