Sha256: f156086be1588e1fce0fc88f23a08503077909b38760b753a1ec6225eaca827b

Contents?: true

Size: 808 Bytes

Versions: 1

Compression:

Stored size: 808 Bytes

Contents

require "spec_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.7 spec/i18n_spec.rb