Sha256: 9aa11f5806300bd74ce8d3d6a591d04778b5f0603ed41291d5afc01b9ecd0bfd

Contents?: true

Size: 1.05 KB

Versions: 28

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe WebTranslateIt::AutoFetch do

  let(:application) { double(:application, :call => []) }

  let(:env) do
    { 'PATH_INFO' => path }
  end

  subject { described_class.new(application) }

  before { WebTranslateIt.stub(:fetch_translations) }

  after { subject.call(env) }

  context 'path is /' do
    let(:path) { '/' }

    it 'should call the application' do
      application.should_receive(:call).with(env)
    end

    it 'should update the translations' do
      WebTranslateIt.should_receive(:fetch_translations)
    end

    it 'should reload the I18n definitions' do
      I18n.should_receive(:reload!)
    end
  end

  context 'path is /assets/application.js' do
    let(:path) { '/assets/application.js' }

    it 'should call the application' do
      application.should_receive(:call).with(env)
    end

    it 'should not update the translations' do
      WebTranslateIt.should_not_receive(:fetch_translations)
    end

    it 'should not reload the I18n definitions' do
      I18n.should_not_receive(:reload!)
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
web_translate_it-2.5.4 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.5.3 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.5.2 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.5.1 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.5.0 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.12 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.11 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.10 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.9 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.8 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.7 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.6 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.5 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.4 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.3 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.2 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.1 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.4.0 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.3.4 spec/web_translate_it/auto_fetch_spec.rb
web_translate_it-2.3.3 spec/web_translate_it/auto_fetch_spec.rb