Sha256: 2be7f8f3bbe48990d55c5e3ad826812e443f8794898fb6564dbb55e6cebf0504

Contents?: true

Size: 879 Bytes

Versions: 9

Compression:

Stored size: 879 Bytes

Contents

require 'spec/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']
  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
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fast_gettext-0.5.10 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.5.9 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.5.8 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.5.7 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.5.6 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.5.5 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.5.4 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.5.3 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.5.2 spec/fast_gettext/translation_repository/mo_spec.rb