Project

wanderlust

0.0
No commit activity in last 3 years
No release in over 3 years
MySQL Timezone support for your ActiveRecord specs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Wanderlust

A convenient way to enable MySQL timezone support for your ActiveRecord specs. It's mainly for your dev and CI environments, as it will import a set of timezones into your MySQL instance. This should not be used in Production.

If you'd like to get MySQL timezone support on your Mac without using Wanderlust, this should do the trick:

mysql_tzinfo_to_sql /usr/share/zoneinfo | sed -e "s/Local time zone must be set--see zic manual page/local/" | mysql -u root mysql

This gem is compatible with at least MySQL 5.6.19.

Installation

Add this line to your application's Gemfile in the development or test groups:

group :development, :test do
  gem 'wanderlust'
end

And then execute:

$ bundle

Usage

Here's what the usage would look like in your typical spec_helper:

RSpec.configure do |config|

  config.before(:suite) do
    Wanderlust.ensure_timezones
    DatabaseCleaner.strategy = :transaction
    # etc...
  end
end

Wanderlust will import timezones into your MySQL instance, so if you'd like to remove them after your specs:

  config.after(:suite) do
    Wanderlust.cleanup
  end

Troubleshooting

I get a huge error full of SQL statements. What do I do?

In this case, most likely your MySQL instance is in an odd state or somehow your mysql.time_zone table got truncated without cascading the deletes. Try restarting your MySQL instance and cleaning up remaining timezones, like so:

# /bin/bash or your preferred shell
mysql restart

# in irb/pry
Wanderlust.cleanup

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake true to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/shaqq/wanderlust. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.