Sha256: 925e67c1bbb7ec93324e8ddd18637496a6a533cdd33f8673a846f81a25e530d1

Contents?: true

Size: 846 Bytes

Versions: 1

Compression:

Stored size: 846 Bytes

Contents

require "#{File.expand_path(File.dirname(__FILE__))}/helper"
require 'crystal/support' # to check that i18n will correctly works with ActiveSupport
require 'crystal_ext/i18n'

describe 'I18n' do
  before :all do
    dir = File.expand_path(File.dirname(__FILE__))
    I18n.load_path += Dir["#{dir}/i18n_spec/locales/*/*.{rb,yml}"]
  end
  
  def t *args
    I18n.t *args
  end
  
  it "basic" do
    I18n.locale = 'en'
    t(:name).should == "Name"
    t(:name).is_a?(String).should be_true
    
    I18n.locale = 'ru'
    t(:name).should == "Имя"
  end
  
  it "pluggable pluralization" do
    I18n.locale = 'ru'
    t(:comments_count, :count => 1).should == "1 комментарий"
    t(:comments_count, :count => 2).should == "2 комментария"
    t(:comments_count, :count => 5).should == "5 комментариев"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crystal_ext-0.0.4 spec/i18n_spec.rb