Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save uldza/299e6670989b827bb385 to your computer and use it in GitHub Desktop.

Select an option

Save uldza/299e6670989b827bb385 to your computer and use it in GitHub Desktop.
# Add sinon.js gem to your `group :development, :test`
gem 'sinon-rails'
# Add code to stub javascript time in your application.haml (.erb) layout file, at the same time you are using Timecop.travel
- if defined?(Timecop) && Timecop.top_stack_item
= javascript_include_tag "sinon"
- unix_millis = (Time.now.to_f * 1000.0).to_i
:javascript
sinon.useFakeTimers(#{unix_millis});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment