8000 GitHub - eputnam/beaker-i18n_helper: Beaker helper for i18n testing
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

eputnam/beaker-i18n_helper

Repository files navigation

Beaker::I18nHelper

This gem provides some helper methods for testing i18n and l10n with Beaker.

Installation

Add this line to your application's Gemfile:

gem 'beaker-i18n_helper'

Or install it yourself as:

$ gem install beaker-i18n_helper

Usage

In your spec_helper_acceptance, you may use it like:

c.before :suite do
  hosts.each do |host|
    # Required for binding tests.
    if fact('osfamily') == 'Debian'
      #install language pack on debian systems
      install_language_pack_on(host, "ja_JP.utf-8")
    end
    if fact('osfamily') == 'RedHat'
      if fact('operatingsystemmajrelease') =~ /7/ || fact('operatingsystem') =~ /Fedora/
        shell("yum install -y bzip2")
      end
    end
    #set language
    change_locale_on(host, "ja_JP.utf-8")
    on host, puppet('module', 'install', 'stahnma/epel')
  end
end

Reference

install_language_pack_on(host, lang)

Uses Beaker's install_package to install a language pack for the desired language. Takes the host and lang, a POSIX locale identifier ([lang]_[region].[charset])

install_language_pack_on(host, 'ja_JP.utf-8')

Usually only needed for Debian systems, RHEL installs all language packs by default.

change_locale_on(host, lang)

Takes in a POSIX locale identifier, lang, and sets $LANG, $LANGUAGE, and on the target host to #{lang}.

change_locale_on(host, "de_DE.utf-8")

Limitations

So far, this helper has only been tested for use with Debian and RedHat hosts.

Development

PRs welcome!

Testing

Unit tests

You can run unit tests with rspec

$ rspec spec/beaker/i18n_helper_spec.rb

Acceptance tests

You can run acceptance tests with rspec, too, plus a little Beaker sugar:

$ BEAKER_provision=yes BEAKER_set=default rspec spec/acceptance

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/puppetlabs/beaker-i18n_helper.

License

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

About

Beaker helper for i18n testing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

Languages

0