Sha256: e0424ab676ec1cafb91e81f5ed0c89bf2d5b1039a51f146a8908b018d97ee9df
Contents?: true
Size: 961 Bytes
Versions: 10
Compression:
Stored size: 961 Bytes
Contents
require "spec_helper" require "rake" require "fileutils" describe GettextSimpleRails::CacheHandler do before do ::Dummy::Application.load_tasks end it "should register when the cache is too old" do static_translation_file_path = "#{Rails.root}/config/locales_gettext/static_translation_file.json" File.unlink(static_translation_file_path) if File.exists?(static_translation_file_path) ::Rake::Task["gettext_simple_rails:generate_translator_files"].execute ::Rake::Task["gettext_simple_rails:generate_static_translation_file"].execute static_file_time = File.mtime(static_translation_file_path) cache_handler = GettextSimpleRails::CacheHandler.new time = File.mtime(cache_handler.newest_po_file) assert time < static_file_time cache_handler.cache_file_too_old?.should eq false sleep 1 FileUtils.touch(cache_handler.newest_po_file) cache_handler.cache_file_too_old?.should eq true end end
Version data entries
10 entries across 10 versions & 1 rubygems