Skip to content

willemave/capybara-mocktime

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Capybara Mocktime

A Ruby gem for synchronizing time between the browser and tests using Timecop and Sinon.

Installation

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

RSpec

require 'capybara/mocktime/rspec'

Usage

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

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Ruby gem for synchronizing time between tests and the browser using Timecop and Sinon.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%