Sha256: 967f7e5b43c4add76f4f72b981d36e5b6447c4b4d6c6e66f3326937e95c4cef2

Contents?: true

Size: 907 Bytes

Versions: 4

Compression:

Stored size: 907 Bytes

Contents

require File.expand_path('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','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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fast_gettext-0.6.1 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.6.0 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.5.13 spec/fast_gettext/translation_repository/mo_spec.rb
fast_gettext-0.5.12 spec/fast_gettext/translation_repository/mo_spec.rb