Sha256: 973a037a839ddd76be9e0f980a5b9a21d36687ebce72feab75e61932070da6e4

Contents?: true

Size: 843 Bytes

Versions: 1

Compression:

Stored size: 843 Bytes

Contents

require 'rspec_ext'
require "#{__FILE__.dirname}/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.5 spec/i18n_spec.rb