Skip to content

Instantly share code, notes, and snippets.

@soulcutter
Created April 30, 2015 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soulcutter/d87c330cd462f16473a9 to your computer and use it in GitHub Desktop.
Save soulcutter/d87c330cd462f16473a9 to your computer and use it in GitHub Desktop.
Timecop Helper
RSpec.configure do |config|
config.around(:each, :timecop_freeze) do |example|
time = example.metadata[:timecop_freeze]
time = Time.current.change(usec: 0) if TrueClass === time
Timecop.freeze(time) do
example.call
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment