{"id":13394937,"url":"https://github.com/alindeman/zonebie","last_synced_at":"2025-05-16T05:04:05.841Z","repository":{"id":2641975,"uuid":"3631442","full_name":"alindeman/zonebie","owner":"alindeman","description":"Zonebie prevents bugs in code that deals with timezones by randomly assigning a zone on every run","archived":false,"fork":false,"pushed_at":"2019-01-04T23:18:27.000Z","size":112,"stargazers_count":429,"open_issues_count":2,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-12T20:17:18.553Z","etag":null,"topics":["ruby","timezone"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alindeman.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-05T21:11:03.000Z","updated_at":"2025-04-28T15:10:49.000Z","dependencies_parsed_at":"2022-08-21T01:50:30.131Z","dependency_job_id":null,"html_url":"https://github.com/alindeman/zonebie","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alindeman%2Fzonebie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alindeman%2Fzonebie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alindeman%2Fzonebie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alindeman%2Fzonebie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alindeman","download_url":"https://codeload.github.com/alindeman/zonebie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471062,"owners_count":22076585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ruby","timezone"],"created_at":"2024-07-30T17:01:36.738Z","updated_at":"2025-05-16T05:04:05.766Z","avatar_url":"https://github.com/alindeman.png","language":"Ruby","readme":"# Zonebie\n\n[![Build Status](https://secure.travis-ci.org/alindeman/zonebie.svg)](http://travis-ci.org/alindeman/zonebie)\n\nZonebie prevents bugs in code that deals with timezones by randomly assigning a\nzone on every run.\n\nIf Zonebie helps trigger a timezone-related bug, you can temporarily assign the\n`ZONEBIE_TZ` environment variable to make your tests deterministic while you\ndebug (more information below).\n\n## Requirements\n\n* MRI (2.0.x, 2.1.x, 2.2.x, 2.3.x, 2.4.x)\n* JRuby (1.7)\n* Rubinius (3.x)\n\n***\n\nAnd **either** of these gems which adds timezone support to Ruby:\n\n* `activesupport` \u003e= 3.0 (Rails 3.0, 3.1, 3.2, 4.0, 4.1, 4.2)\n* `tzinfo` \u003e= 1.2\n\n## Installation\n\nIf using Bundler (recommended), add to Gemfile:\n\n````ruby\ngem 'zonebie'\n````\n\n## Usage with Rails \u0026 Active Support\n\nActive Support allows setting a global timezone that will be used for many date\nand time calculations throughout the application.\n\nZonebie can set this to a random timezone at the beginning of test runs.\nSpecifically for Active Support, it sets `Time.zone`.\n\n### Test::Unit \u0026 Minitest\n\nAdd to `test/test_helper.rb`:\n\n```ruby\nZonebie.set_random_timezone\n```\n\n### RSpec\n\nAdd to `spec/spec_helper.rb`:\n\n```ruby\nrequire \"zonebie/rspec\"\n```\n\n### Cucumber\n\nAdd a file `features/support/zonebie.rb` with the following contents:\n\n```ruby\nZonebie.set_random_timezone\n```\n\n## Usage with TZInfo\n\nZonebie can use the `tzinfo` gem, allowing it to work outside of Active Support\n(Rails).\n\nHowever, `Zonebie.set_random_timezone` does not work outside of Active Support\nbecause there is not a concept of a global timezone setting. If you simply need\na random timezone for some other part of your tests, Zonebie can help.\n\n```ruby\nzone = TZInfo::Timezone.get(Zonebie.random_timezone)\nputs zone.now\n\n# Also works in Rails/Active Support\nzone = ActiveSupport::TimeZone[Zonebie.random_timezone]\nputs zone.now\n```\n\n## Reproducing Bugs\n\nWhen `Zonebie.set_random_timezone` is called, Zonebie assigns a timezone and\nprints a message to STDOUT:\n\n```\n[Zonebie] Setting timezone: ZONEBIE_TZ=\"Eastern Time (US \u0026 Canada)\"\n```\n\nIf you would rather that Zonebie not print out this information during your\ntests, put Zonebie in quiet mode before calling `set_random_timezone`:\n\n```ruby\nZonebie.quiet = true\n```\n\nTo rerun tests with a specific timezone (e.g., to reproduce a bug that only\nseems present in one zone), set the `ZONEBIE_TZ` environment variable:\n\n```ruby\n# Assuming tests run with simply `rake`\nZONEBIE_TZ=\"Eastern Time (US \u0026 Canada)\" rake\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falindeman%2Fzonebie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falindeman%2Fzonebie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falindeman%2Fzonebie/lists"}