Sha256: 2986d93d8367b111c93c00b7b25e2a6f6ccb9184e26fea4d9445ff02359bd2ea

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Lolita::I18n do 
  describe "loaded" do 
    it "should check Redis connection after Lolita.setup" do 
      Lolita.i18n.should_receive(:yaml_backend=).and_return(double())
      Lolita.i18n.should_receive(:include_modules).and_return(true)
      chain = double("chain")
      Lolita.i18n.should_receive(:initialize_chain).and_return(chain)
      redis = double("redis")
      Redis.stub(:new).and_return(redis)
      redis.stub(:ping => true)
      ::I18n.should_receive(:backend=).with(chain)
      
      Lolita.setup{}
    end

    it "should warn when Redis is not available" do 
      Lolita.i18n.should_receive(:yaml_backend=).and_return(double())
      Lolita.i18n.should_receive(:include_modules).and_return(true)
      redis = double("redis")
      Redis.stub(:new).and_return(redis)
      redis.stub(:ping).and_raise(Errno::ECONNREFUSED)
      
      Lolita.setup{}
    end

    it "should add #i18n to Lolita configuration" do 
      Lolita.configuration.should respond_to(:i18n)
    end

    it "should have Request,Configuration,Exceptions constants in module" do 
      Lolita::I18n::Request.should be_kind_of(Class)
      Lolita::I18n::Configuration.should be_kind_of(Class)
      Lolita::I18n::Exceptions.should be_kind_of(Module)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lolita-i18n-0.4.2 spec/lolita_i18n_spec.rb
lolita-i18n-0.4.0 spec/lolita_i18n_spec.rb