GithubHelp home page GithubHelp logo

beaker-i18n_helper's Introduction

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.

beaker-i18n_helper's People

Contributors

eputnam avatar hail9000 avatar pmcmaw avatar tphoney avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.