You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
timecop-console exposes controllers/routes for manipulating Time.now (using the Timecop gem) from your app. This is especially useful during development and QA, as you can very easily simulate the movement of time. Just as timecop gives you this ability within your tests, you can now easily make this available to your dev and QA team through a debug console.
Avoid having ‘timecop-console` gem as part of `test` group if you use Timecop in your tests to avoid any hard-to-debug exceptions.
By requiring this dependency, it will open up ActionController::Base and inject an around_filter that will manage Time.now and friends for you.
You’ll want to hook in the mountable engine for handling time changes in the specific environments that you want this to load in (probably only development, staging). Modify your ‘config/routes.rb`, adding:
Then, to take advantage of this, you’ll want to add a snippet of code to the bottom of your application’s layout file, e.g.:
<% if Rails.env.development? || Rails.env.staging? %>
<%= timecop_console_layout %>
<% end %>
This snippet exposes fields to allow you to alter each component of time (year, month, day, hour, minute, second). It’s raw, and there is no validation whatsoever. A default (and customizable) snippet like this will be added to this library shortly. In the meantime, you can hand-write it.