https://github.com/remind101/capybara-mocktime
Ruby gem for synchronizing time between tests and the browser using Timecop and Sinon.
https://github.com/remind101/capybara-mocktime
Last synced: over 1 year ago
JSON representation
Ruby gem for synchronizing time between tests and the browser using Timecop and Sinon.
- Host: GitHub
- URL: https://github.com/remind101/capybara-mocktime
- Owner: remind101
- License: mit
- Created: 2013-12-16T16:33:16.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-01-28T18:37:44.000Z (over 12 years ago)
- Last Synced: 2025-04-05T20:02:52.443Z (over 1 year ago)
- Language: Ruby
- Size: 121 KB
- Stars: 3
- Watchers: 94
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# 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:
```ruby
gem 'capybara-mocktime'
```
Include the rack middleware to inject the fake time into the document.
```ruby
Capybara.app = Rack::Builder.app do
use Rack::Mocktime
run App
end
```
### RSpec
```ruby
require 'capybara/mocktime/rspec'
```
## Usage
### RSpec
Tag your specs with a `mock_time` value:
```ruby
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