A Ruby gem for synchronizing time between the browser and tests using Timecop and Sinon.
Add this line to your application's Gemfile:
gem 'capybara-mocktime'
Include the rack middleware to inject the fake time into the document.
Capybara.app = Rack::Builder.app do
use Rack::Mocktime
run App
end
require 'capybara/mocktime/rspec'
Tag your specs with a mock_time
value:
context 'when the browser time is 8:30am', mock_time: '8:30am' do
it 'does something'
end
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request