All Projects → alindeman → Zonebie

alindeman / Zonebie

Licence: mit
Zonebie prevents bugs in code that deals with timezones by randomly assigning a zone on every run

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Zonebie

Positional
An elegant and colorful location information app for Android with Compass, Clock, Level, Sun, Moon, Trail Marker and many other features.
Stars: ✭ 72 (-81.15%)
Mutual labels:  timezone
setup-timezone
setup timezone for actions
Stars: ✭ 20 (-94.76%)
Mutual labels:  timezone
tz
🌐 A time zone helper
Stars: ✭ 528 (+38.22%)
Mutual labels:  timezone
slack-timezone-bot
🤖⏰ Slack bot to show time in users' timezones
Stars: ✭ 51 (-86.65%)
Mutual labels:  timezone
geo-sql-database
Continents, Sub-Continents, Countries, States, Cities, Timezones, Currencies SQL database.
Stars: ✭ 30 (-92.15%)
Mutual labels:  timezone
ng2-timezone-selector
A simple Angular module to create a timezone selector using moment-timezone.
Stars: ✭ 12 (-96.86%)
Mutual labels:  timezone
timezone
Timezone project providing a simple way to turn location and unix timestamp into timezone and local time.
Stars: ✭ 24 (-93.72%)
Mutual labels:  timezone
Spacetime
A lightweight javascript timezone library
Stars: ✭ 3,463 (+806.54%)
Mutual labels:  timezone
google-photos-timezone-fix
Iterates over photos in given Google Photos album and edits date/time/timezone of each photo in order to fix their order
Stars: ✭ 22 (-94.24%)
Mutual labels:  timezone
gwt-time
Backport of functionality based on JSR-310 to GWT. This is NOT an implementation of JSR-310.
Stars: ✭ 17 (-95.55%)
Mutual labels:  timezone
timezones
Nim timezone library compatible with the standard library.
Stars: ✭ 37 (-90.31%)
Mutual labels:  timezone
Shell-Scripts
Shell scripts about some basic topics, current time, calculator, sorting, restaurant and more.
Stars: ✭ 100 (-73.82%)
Mutual labels:  timezone
simple-location
Adds Basic Location Support to Wordpress
Stars: ✭ 26 (-93.19%)
Mutual labels:  timezone
node-red-contrib-moment
Node-Red Node that produces formatted Date/Time output using the Moment.JS library. Timezone, dst and locale aware.
Stars: ✭ 31 (-91.88%)
Mutual labels:  timezone
NTP
NTP library for Arduino framework
Stars: ✭ 20 (-94.76%)
Mutual labels:  timezone
IP2Location-PHP-Module
This module is a PHP module that enables the user to find the country, region, city, coordinates, zip code, ISP, domain name, timezone, connection speed, IDD code, area code, weather station code, weather station name, mobile, usage types, address type, IAB category, etc that any IP address or host name originates from.
Stars: ✭ 154 (-59.69%)
Mutual labels:  timezone
intl-format
A wrapper library for PHP to format and internationalize values in messages like sprintf
Stars: ✭ 12 (-96.86%)
Mutual labels:  timezone
Googleapi
C# .NET Core Google Api (Maps, Places, Roads, Search, Translate). Supports all endpoints and requests / responses.
Stars: ✭ 346 (-9.42%)
Mutual labels:  timezone
Time4j
Advanced date, time and interval library for Java with sun/moon-astronomy and calendars like Chinese, Coptic, Ethiopian, French Republican, Hebrew, Hijri, Historic Christian, Indian National, Japanese, Julian, Korean, Minguo, Persian, Thai, Vietnamese
Stars: ✭ 328 (-14.14%)
Mutual labels:  timezone
nepali-datetime
Python's core datetime inspired nepali datetime (BS date & NPT) package 🇳🇵
Stars: ✭ 36 (-90.58%)
Mutual labels:  timezone

Zonebie

Build Status

Zonebie prevents bugs in code that deals with timezones by randomly assigning a zone on every run.

If Zonebie helps trigger a timezone-related bug, you can temporarily assign the ZONEBIE_TZ environment variable to make your tests deterministic while you debug (more information below).

Requirements

  • MRI (2.0.x, 2.1.x, 2.2.x, 2.3.x, 2.4.x)
  • JRuby (1.7)
  • Rubinius (3.x)

And either of these gems which adds timezone support to Ruby:

  • activesupport >= 3.0 (Rails 3.0, 3.1, 3.2, 4.0, 4.1, 4.2)
  • tzinfo >= 1.2

Installation

If using Bundler (recommended), add to Gemfile:

gem 'zonebie'

Usage with Rails & Active Support

Active Support allows setting a global timezone that will be used for many date and time calculations throughout the application.

Zonebie can set this to a random timezone at the beginning of test runs. Specifically for Active Support, it sets Time.zone.

Test::Unit & Minitest

Add to test/test_helper.rb:

Zonebie.set_random_timezone

RSpec

Add to spec/spec_helper.rb:

require "zonebie/rspec"

Cucumber

Add a file features/support/zonebie.rb with the following contents:

Zonebie.set_random_timezone

Usage with TZInfo

Zonebie can use the tzinfo gem, allowing it to work outside of Active Support (Rails).

However, Zonebie.set_random_timezone does not work outside of Active Support because there is not a concept of a global timezone setting. If you simply need a random timezone for some other part of your tests, Zonebie can help.

zone = TZInfo::Timezone.get(Zonebie.random_timezone)
puts zone.now

# Also works in Rails/Active Support
zone = ActiveSupport::TimeZone[Zonebie.random_timezone]
puts zone.now

Reproducing Bugs

When Zonebie.set_random_timezone is called, Zonebie assigns a timezone and prints a message to STDOUT:

[Zonebie] Setting timezone: ZONEBIE_TZ="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 ZONEBIE_TZ environment variable:

# Assuming tests run with simply `rake`
ZONEBIE_TZ="Eastern Time (US & Canada)" rake

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].