Sha256: 5d2328ea89cb06e60450cfb34d20f1fd9ce371935980306ab87b62c360797f72

Contents?: true

Size: 999 Bytes

Versions: 7

Compression:

Stored size: 999 Bytes

Contents

require "spec_helper"

describe 'FastGettext::TranslationRepository::Mo' do
  before do
    @rep = FastGettext::TranslationRepository.build('test',:path=>File.join('spec', 'locale'))
    @rep.is_a?(FastGettext::TranslationRepository::Mo).should be_true
  end

  it "can be built" do
    @rep.available_locales.sort.should == ['de','en','gsw_CH']
  end

  it "can translate" do
    FastGettext.locale = 'de'
    @rep['car'].should == 'Auto'
  end

  it "can pluralize" do
    FastGettext.locale = 'de'
    @rep.plural('Axis','Axis').should == ['Achse','Achsen']
  end

  it "has access to the mo repositories pluralisation rule" do
    FastGettext.locale = 'en'
    rep = FastGettext::TranslationRepository.build('plural_test',:path=>File.join('spec','locale'))
    rep['car'].should == 'Test'#just check it is loaded correctly
    rep.pluralisation_rule.call(2).should == 3
  end

  it "can work in SAFE mode" do
    `ruby spec/cases/safe_mode_can_handle_locales.rb 2>&1`.should == 'true'
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fast_gettext-0.7.0 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.6.12 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.6.11 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.6.10 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.6.9 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.6.8 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.6.7 spec/fast_gettext/translation_repository/mo_spec.rb