Sha256: d69a3544e6c5f39d592e9dd0ccfc58b1b599113fb5f4a9d61a0138a0dec00231

Contents?: true

Size: 1.07 KB

Versions: 9

Compression:

Stored size: 1.07 KB

Contents

current_folder = File.dirname(__FILE__)
require File.join(current_folder,'..','..','spec_helper')


describe 'FastGettext::TranslationRepository::Mo' do
  before do
    @rep = FastGettext::TranslationRepository.build('test',:path=>File.join(current_folder,'..','..','locale'))
    @rep.is_a? FastGettext::TranslationRepository::Mo
  end
  it "can be built" do
    @rep.available_locales.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 "stores pluralisation rule" do
    @rep.pluralisation_rule = lambda{|n|n+1}
    @rep.pluralisation_rule.call(3).should == 4
  end
  it "has access to the mo repositories pluralisation rule" do
    FastGettext.locale = 'en'
    rep = FastGettext::TranslationRepository.build('plural_test',:path=>File.join(current_folder,'..','..','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
grosser-fast_gettext-0.3.0 spec/fast_gettext/translation_repository/mo_spec.rb
grosser-fast_gettext-0.3.1 spec/fast_gettext/translation_repository/mo_spec.rb
grosser-fast_gettext-0.3.2 spec/fast_gettext/translation_repository/mo_spec.rb
grosser-fast_gettext-0.3.3 spec/fast_gettext/translation_repository/mo_spec.rb
grosser-fast_gettext-0.3.4 spec/fast_gettext/translation_repository/mo_spec.rb
grosser-fast_gettext-0.3.5 spec/fast_gettext/translation_repository/mo_spec.rb
grosser-fast_gettext-0.3.6 spec/fast_gettext/translation_repository/mo_spec.rb
grosser-fast_gettext-0.3.7 spec/fast_gettext/translation_repository/mo_spec.rb
grosser-fast_gettext-0.3.8 spec/fast_gettext/translation_repository/mo_spec.rb