Sha256: 909c8f3946c7fa239ef01384eb6d11f5ea5f091aa1c3194e8a20f6c3b6286550

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

require 'spec'
require 'RubyExt/Localization/require'

module RubyExt
  describe "RubyExt::Localization" do
    before :each do
      RubyExt::Localization.default_language = :en
      RubyExt::Localization.language = nil
    end
    
    it "Default Language" do
      ForLocalization::NS::B.new.message.should == "English"
      RubyExt::Localization.default_language = :ru
      ForLocalization::NS::B.new.message.should == "Russian"
    end
    
    it "Not Localized" do
      RubyExt::Localization.default_language = :ru
      ForLocalization::NS::B.new.not_localized.should == "English Not Localized"
    end
    
    it "Language set" do
      ForLocalization::NS::B.new.message.should == "English"
      RubyExt::Localization.language = lambda{:ru}
      ForLocalization::NS::B.new.message.should == "Russian"
    end
    
    it "Language not set" do
      RubyExt::Localization.language = lambda{nil}
      ForLocalization::NS::B.new.message.should == "English"
    end
    
    it "Class Hierarchy" do
      RubyExt::Localization.language = lambda{:ru}
      ForLocalization::NS::B.new.class_hierarchy_message.should == "Class Hierarchy Russian"
    end
    
    it "Namespace Hierarchy" do
      RubyExt::Localization.language = lambda{:ru}
      ForLocalization::NS::B.new.namespace_hierarchy_message.should ==
          "Namespace Hierarchy Russian"
    end
    
    it "Substitution" do
      RubyExt::Localization.language = lambda{:ru}
      ForLocalization::NS::B.new.substitution.should == "Russian 10"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-ext-0.4.1 old/spec/localization_spec.rb
ruby-ext-0.4.0 old/spec/localization_spec.rb