Sha256: 56647945c2e7454678636837c7479ada7a13e5b72978c7a9b24503bb7afc9bfb

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

require File.expand_path('spec/spec_helper')

describe 'FastGettext::TranslationRepository::Logger' do
  before do
    @callback = lambda{}
    @rep = FastGettext::TranslationRepository.build('test', :type=>:logger, :callback=>@callback)
    @rep.is_a?(FastGettext::TranslationRepository::Logger).should be_true
  end
  subject{@rep}

  it{ should have(0).available_locales}

  it "has no pluralisation_rule" do
    @rep.pluralisation_rule.should == nil
  end

  describe :single do
    it "logs every call" do
      @callback.should_receive(:call).with('the_key')
      @rep['the_key']
    end

    it "returns nil" do
      @callback.should_receive(:call).with('the_key').and_return 'something'
      @rep['the_key'].should == nil
    end
  end

  describe :plural do
    it "logs every call" do
      @callback.should_receive(:call).with(['a','b'])
      @rep.plural('a','b')
    end

    it "returns an empty array" do
      @callback.should_receive(:call).with(['a','b']).and_return 'something'
      @rep.plural('a','b').should == []
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fast_gettext-0.6.6 spec/fast_gettext/translation_repository/logger_spec.rb
fast_gettext-0.6.5 spec/fast_gettext/translation_repository/logger_spec.rb
fast_gettext-0.6.4 spec/fast_gettext/translation_repository/logger_spec.rb
fast_gettext-0.6.3 spec/fast_gettext/translation_repository/logger_spec.rb
fast_gettext-0.6.2 spec/fast_gettext/translation_repository/logger_spec.rb
fast_gettext-0.6.1 spec/fast_gettext/translation_repository/logger_spec.rb
fast_gettext-0.6.0 spec/fast_gettext/translation_repository/logger_spec.rb
fast_gettext-0.5.13 spec/fast_gettext/translation_repository/logger_spec.rb
fast_gettext-0.5.12 spec/fast_gettext/translation_repository/logger_spec.rb
fast_gettext-0.5.11 spec/fast_gettext/translation_repository/logger_spec.rb