TODO: Travis-CI build image
Zonebie prevents bugs in code that deals with timezones by randomly assigning a zone on every run.
Tests must run green against:
- Ruby 1.8.7, 1.9.2, 1.9.3
- JRuby 1.6 (1.8 and 1.9 mode)
- Rubinius 1.2 and 2.0 (1.8 and 1.9 mode)
A gem that adds timezone support; currently supported is:
activesupport
>= 2.3 (compatible with Rails 2.3, 3.0, 3.1, 3.2)
OR
- Unimplemented
tzinfo
If using Bundler (recommended), add to Gemfile:
gem 'zonebie'
Add to test/test_helper.rb
:
Zonebie.set_random_timezone
Add to spec/spec_helper.rb
after require "rspec"
or require "rspec/rails"
:
require "zonebie/rspec"
Add a file features/support/zonebie.rb
with the following contents:
Zonebie.set_random_timezone
When Zonebie.set_random_timezone
is called (if using RSpec, this call is
automatically setup for you), Zonebie assigns a timezone and prints a message
to STDOUT:
[Zonebie] Setting timezone to "Eastern Time (US & Canada)"
If you would rather that Zonebie not print out this information during your tests,
put Zonebie in quiet mode before calling set_random_timezone
:
Zonebie.quiet = true
To rerun tests with a specific timezone (e.g., to reproduce a bug that only
seems present in one zone), set the TZ
environment variable:
# Assuming tests run with simply `rake`
TZ="Eastern Time (US & Canada)" rake
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request