Sha256: ad2af9666e822ad582878966741ab41606032a679d3047b136ef4431a0fa3f69

Contents?: true

Size: 953 Bytes

Versions: 1

Compression:

Stored size: 953 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'spec_helper')

describe WebTranslateIt::TranslationFile do
  before(:each) do
    @translation_file = WebTranslateIt::TranslationFile.new(1174, "/config/locales/[locale].yml", "04b254da22a6eb301b103f848e469ad494eea47d")
  end
  
  describe "#fetch" do
    it "should prepare a HTTP request and get a 200 OK if the language file is stale" do
      file = mock(File)
      file.stub(:puts => true, :close => true)
      File.stub(:exist? => true, :mtime => Time.at(0), :new => file)
      @translation_file.fetch('fr_FR').should == 200
    end
    
    it "should prepare a HTTP request and get a 304 OK if the language file is fresh" do
      file = mock(File)
      file.stub(:puts => true, :close => true)
      File.stub(:exist? => true, :mtime => Time.now, :new => file)
      @translation_file.stub(:path_to_locale_file => file)
      @translation_file.fetch('fr_FR').should == 304
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
web_translate_it-1.4.0 spec/web_translate_it/translation_file_spec.rb