From 5fb7d938b4eb6ae19d892bc4d8333ffe68436e77 Mon Sep 17 00:00:00 2001 From: alunny Date: Thu, 24 Jan 2013 13:19:01 -0800 Subject: [PATCH 1/4] changes to test * move `test/unit/command_line_test` to `test/integration/test_command_line` * require `test_helper` in all test files and require `test/unit` in test_helper this allows any test file to be run individually as: `ruby test/unit/test_uglifier.rb` * modify `test/unit/jammit_helpers` to force rails 2.3 compatibility with ruby 1.9.3 * modify `test/integration/test_command_line` to resolve asset paths correctly, and to make debugging a bit easier (still has a couple failing tests) * modify `test/configuration` to work with ruby 1.9's unicode-by-default strings --- test/integration/test_command_line.rb | 50 ++++++++++++++++++++++++ test/test_helper.rb | 1 + test/unit/command_line_test.rb | 35 ----------------- test/unit/test_closure_compressor.rb | 2 +- test/unit/test_compressor.rb | 2 +- test/unit/test_configuration.rb | 11 +++++- test/unit/test_in_the_wrong_directory.rb | 2 +- test/unit/test_jammit_controller.rb | 2 +- test/unit/test_jammit_helpers.rb | 6 ++- test/unit/test_packager.rb | 2 +- test/unit/test_sass_compressor.rb | 4 +- test/unit/test_uglifier.rb | 4 +- 12 files changed, 74 insertions(+), 47 deletions(-) create mode 100644 test/integration/test_command_line.rb delete mode 100644 test/unit/command_line_test.rb diff --git a/test/integration/test_command_line.rb b/test/integration/test_command_line.rb new file mode 100644 index 00000000..bd2fac20 --- /dev/null +++ b/test/integration/test_command_line.rb @@ -0,0 +1,50 @@ +$: << File.expand_path(File.dirname(__FILE__) + "/..") ; require 'test_helper' +require 'zlib' + +class CommandLineTest < Test::Unit::TestCase + + def setup + ENV['RAILS_ROOT'] = 'test' + end + + def teardown + begin + FileUtils.rm_r('test/precache') + rescue Errno::ENOENT + end + end + + def test_version_and_help_can_run + assert system('bin/jammit -v > /dev/null') + assert system('bin/jammit -h > /dev/null') + end + + def test_jammit_precaching + system('bin/jammit -c test/config/assets.yml -o test/precache -u http://www.example.com') + assert_equal PRECACHED_FILES, glob('test/precache/*') + + assert_equal zlib_read('test/precache/css_test-datauri.css.gz'), + File.read('test/fixtures/jammed/css_test-datauri.css') + + assert_equal zlib_read('test/precache/jst_test.js.gz'), + File.read('test/fixtures/jammed/jst_test.js') + + assert_equal zlib_read('test/precache/js_test_with_templates.js.gz'), + File.read('test/fixtures/jammed/js_test_with_templates.js') + end + + def test_lazy_precaching + system('bin/jammit -c test/config/assets.yml -o test/precache -u http://www.example.com') + assert_equal PRECACHED_FILES, glob('test/precache/*') + mtime = File.mtime(PRECACHED_FILES.first) + system('bin/jammit -c test/config/assets.yml -o test/precache -u http://www.example.com') + assert_equal File.mtime(PRECACHED_FILES.first), mtime + system('bin/jammit -c test/config/assets.yml -o test/precache -u http://www.example.com --force') + assert File.mtime(PRECACHED_FILES.first) > mtime + end + + def zlib_read(filename) + Zlib::GzipReader.open(filename) {|f| f.read } + end + +end diff --git a/test/test_helper.rb b/test/test_helper.rb index b1fe3497..65b968d2 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,6 @@ Encoding.default_external = 'ascii' if defined? Encoding +require 'test/unit' require 'logger' ASSET_ROOT = File.expand_path(File.dirname(__FILE__)) diff --git a/test/unit/command_line_test.rb b/test/unit/command_line_test.rb deleted file mode 100644 index 08ec9ec2..00000000 --- a/test/unit/command_line_test.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'test_helper' -require 'zlib' - -class CommandLineTest < Test::Unit::TestCase - - def teardown - begin - FileUtils.rm_r('test/precache') - rescue Errno::ENOENT - end - end - - def test_version_and_help_can_run - assert system('bin/jammit -v') && system('bin/jammit -h') - end - - def test_jammit_precaching - system('bin/jammit -c test/config/assets.yml -o test/precache -u http://www.example.com') - assert PRECACHED_FILES == glob('test/precache/*') - assert Zlib::GzipReader.open('test/precache/css_test-datauri.css.gz') {|f| f.read } == File.read('test/fixtures/jammed/css_test-datauri.css') - assert Zlib::GzipReader.open('test/precache/jst_test.js.gz') {|f| f.read } == File.read('test/fixtures/jammed/jst_test.js') - assert Zlib::GzipReader.open('test/precache/js_test_with_templates.js.gz') {|f| f.read } == File.read('test/fixtures/jammed/js_test_with_templates.js') - end - - def test_lazy_precaching - system('bin/jammit -c test/config/assets.yml -o test/precache -u http://www.example.com') - assert PRECACHED_FILES == glob('test/precache/*') - mtime = File.mtime(PRECACHED_FILES.first) - system('bin/jammit -c test/config/assets.yml -o test/precache -u http://www.example.com') - assert File.mtime(PRECACHED_FILES.first) == mtime - system('bin/jammit -c test/config/assets.yml -o test/precache -u http://www.example.com --force') - assert File.mtime(PRECACHED_FILES.first) > mtime - end - -end diff --git a/test/unit/test_closure_compressor.rb b/test/unit/test_closure_compressor.rb index 6a3dacbc..f2691611 100644 --- a/test/unit/test_closure_compressor.rb +++ b/test/unit/test_closure_compressor.rb @@ -1,4 +1,4 @@ -require 'test_helper' +$: << File.expand_path(File.dirname(__FILE__) + "/..") ; require 'test_helper' class ClosureCompressorTest < Test::Unit::TestCase diff --git a/test/unit/test_compressor.rb b/test/unit/test_compressor.rb index eec8ad67..f0b25d23 100644 --- a/test/unit/test_compressor.rb +++ b/test/unit/test_compressor.rb @@ -1,4 +1,4 @@ -require 'test_helper' +$: << File.expand_path(File.dirname(__FILE__) + "/..") ; require 'test_helper' class CompressorTest < Test::Unit::TestCase diff --git a/test/unit/test_configuration.rb b/test/unit/test_configuration.rb index 1376a855..1c3726aa 100644 --- a/test/unit/test_configuration.rb +++ b/test/unit/test_configuration.rb @@ -1,4 +1,4 @@ -require 'test_helper' +$: << File.expand_path(File.dirname(__FILE__) + "/..") ; require 'test_helper' class BrokenConfigurationTest < Test::Unit::TestCase @@ -26,8 +26,15 @@ def test_disabled_compression # Nothing should change with jst. packed = @compressor.compile_jst(glob('test/fixtures/src/*.jst')) assert_equal packed, File.read('test/fixtures/jammed/jst_test.js') + # CSS packed = @compressor.compress_css(glob('test/fixtures/src/*.css')) - assert_equal packed, File.open('test/fixtures/jammed/css_test-uncompressed.css', 'rb') {|f| f.read } + uncompressed_css = File.read('test/fixtures/jammed/css_test-uncompressed.css') + + # fun with unicode + if uncompressed_css.respond_to?(:encoding) + uncompressed_css.force_encoding("UTF-8") + end + assert_equal packed, uncompressed_css end def test_css_compression diff --git a/test/unit/test_in_the_wrong_directory.rb b/test/unit/test_in_the_wrong_directory.rb index cc7a3929..0338e646 100644 --- a/test/unit/test_in_the_wrong_directory.rb +++ b/test/unit/test_in_the_wrong_directory.rb @@ -1,4 +1,4 @@ -require 'test_helper' +$: << File.expand_path(File.dirname(__FILE__) + "/..") ; require 'test_helper' class WrongDirectoryTest < Test::Unit::TestCase diff --git a/test/unit/test_jammit_controller.rb b/test/unit/test_jammit_controller.rb index 3a66ab5b..116c25d8 100644 --- a/test/unit/test_jammit_controller.rb +++ b/test/unit/test_jammit_controller.rb @@ -1,4 +1,4 @@ -require 'test_helper' +$: << File.expand_path(File.dirname(__FILE__) + "/..") ; require 'test_helper' require 'active_support' require 'action_pack' require 'action_controller' diff --git a/test/unit/test_jammit_helpers.rb b/test/unit/test_jammit_helpers.rb index c7ca9739..33a837a5 100644 --- a/test/unit/test_jammit_helpers.rb +++ b/test/unit/test_jammit_helpers.rb @@ -1,9 +1,13 @@ -require 'test_helper' +$: << File.expand_path(File.dirname(__FILE__) + "/..") ; require 'test_helper' require 'action_pack' require 'action_view' require 'action_view/base' require 'action_controller' require 'action_controller/base' + +# fix for ruby 1.9.3 compatibility with rails 2.3.14 +MissingSourceFile::REGEXPS << [/^cannot load such file -- (.+)$/i, 1] + require 'action_view/test_case' require 'jammit/controller' require 'jammit/helper' diff --git a/test/unit/test_packager.rb b/test/unit/test_packager.rb index 38743ba6..34de48bd 100644 --- a/test/unit/test_packager.rb +++ b/test/unit/test_packager.rb @@ -1,4 +1,4 @@ -require 'test_helper' +$: << File.expand_path(File.dirname(__FILE__) + "/..") ; require 'test_helper' require 'zlib' class PackagerTest < Test::Unit::TestCase diff --git a/test/unit/test_sass_compressor.rb b/test/unit/test_sass_compressor.rb index 3b2b5761..8c5b2b3d 100644 --- a/test/unit/test_sass_compressor.rb +++ b/test/unit/test_sass_compressor.rb @@ -1,4 +1,4 @@ -require 'test_helper' +$: << File.expand_path(File.dirname(__FILE__) + "/..") ; require 'test_helper' class SassCompressorTest < Test::Unit::TestCase def test_css_compression @@ -7,4 +7,4 @@ def test_css_compression assert_equal File.read('test/fixtures/jammed/css_test-sass.css'), packed end -end \ No newline at end of file +end diff --git a/test/unit/test_uglifier.rb b/test/unit/test_uglifier.rb index 61ee4124..5901045e 100644 --- a/test/unit/test_uglifier.rb +++ b/test/unit/test_uglifier.rb @@ -1,4 +1,4 @@ -require 'test_helper' +$: << File.expand_path(File.dirname(__FILE__) + "/..") ; require 'test_helper' class UglifierText < Test::Unit::TestCase @@ -21,4 +21,4 @@ def test_jst_compilation assert packed == File.read('test/fixtures/jammed/jst_test.js') end -end \ No newline at end of file +end From 1a6db78845bcecc95663be400c6c280648e8530c Mon Sep 17 00:00:00 2001 From: alunny Date: Thu, 24 Jan 2013 13:24:05 -0800 Subject: [PATCH 2/4] dependencies/Rakefile housekeeping * explicitly ignore Gemfile.lock * update sass to work with 6f0c0969 * change redgreen require (from b6dd1b1) to always require - it should be present after `bundle install`, and the `Gem` method isn't supported in all environments * add yard as a development dependency * require rubygems explicitly, to avoid weirdness in some environments * only declare Jammit::VERSION in one place * remove `sudo` from rake tasks - it doesn't play well with tools like rvm, and it's easy to run the whole command as sudo --- .gitignore | 1 + Gemfile | 3 ++- Rakefile | 9 +++++---- jammit.gemspec | 7 ++++++- lib/jammit/dependencies.rb | 5 +++++ 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 2fc547fe..75b7c6b0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ example raws test/precache +Gemfile.lock diff --git a/Gemfile b/Gemfile index acab7bcb..42364b3e 100644 --- a/Gemfile +++ b/Gemfile @@ -10,10 +10,11 @@ group :development, :test do gem "yui-compressor", "0.9.6" gem "closure-compiler", "1.1.6" gem "uglifier", "1.2.4" - gem "sass", "3.1.7" + gem "sass", "~>3.2" end group :development do gem "RedCloth", "4.2.9" gem "redgreen", "1.2.2" + gem "yard" end diff --git a/Rakefile b/Rakefile index 277dd2de..94b5b0b4 100644 --- a/Rakefile +++ b/Rakefile @@ -4,8 +4,9 @@ desc 'Run all tests' task :test, [:path] do |task, args| ENV['RAILS_ENV'] = 'test' $LOAD_PATH.unshift(File.expand_path('test')) - require 'redgreen' unless Gem::Specification.find_all_by_name('redgreen').empty? - require 'test/unit' + + require 'redgreen' + if args[:path] require args[:path] else @@ -26,12 +27,12 @@ namespace :gem do desc 'Build and install the jammit gem' task :install do sh "gem build jammit.gemspec" - sh "sudo gem install #{Dir['*.gem'].join(' ')} --local --no-ri --no-rdoc" + sh "gem install #{Dir['*.gem'].join(' ')} --local --no-ri --no-rdoc" end desc 'Uninstall the jammit gem' task :uninstall do - sh "sudo gem uninstall -x jammit" + sh "gem uninstall -x jammit" end end diff --git a/jammit.gemspec b/jammit.gemspec index c3d36917..de0349cf 100644 --- a/jammit.gemspec +++ b/jammit.gemspec @@ -1,6 +1,11 @@ +lib = File.expand_path('../lib/', __FILE__) +$:.unshift lib unless $:.include?(lib) + +require 'jammit' + Gem::Specification.new do |s| s.name = 'jammit' - s.version = '0.6.5' # Keep version in sync with jammit.rb + s.version = Jammit::VERSION s.date = '2011-11-30' s.homepage = "http://documentcloud.github.com/jammit/" diff --git a/lib/jammit/dependencies.rb b/lib/jammit/dependencies.rb index 9714bd8a..37093410 100644 --- a/lib/jammit/dependencies.rb +++ b/lib/jammit/dependencies.rb @@ -7,6 +7,11 @@ require 'pathname' require 'fileutils' +# Pretty dependent on gems +unless defined? Gem + require 'rubygems' +end + # Try Uglifier. begin require 'uglifier' From 2930f18403576e977d37d846b9d0a8490e85790f Mon Sep 17 00:00:00 2001 From: alunny Date: Thu, 24 Jan 2013 13:41:59 -0800 Subject: [PATCH 3/4] travis CI integration * isolate Jammit::VERSION into single file (easy to require) * remove redgreen from Rakefile (contentious?) * remove -rrubygems from bin/jammit - use inline require * use `bundle exec` path in tests --- .travis.yml | 5 +++++ Rakefile | 2 -- bin/jammit | 5 +++-- jammit.gemspec | 2 +- lib/jammit.rb | 2 -- lib/jammit/version.rb | 3 +++ test/integration/test_command_line.rb | 13 +++++++------ 7 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 .travis.yml create mode 100644 lib/jammit/version.rb diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..884fc6a2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: ruby +rvm: + - "1.8.7" + - "1.9.2" + - "1.9.3" diff --git a/Rakefile b/Rakefile index 94b5b0b4..8082a163 100644 --- a/Rakefile +++ b/Rakefile @@ -5,8 +5,6 @@ task :test, [:path] do |task, args| ENV['RAILS_ENV'] = 'test' $LOAD_PATH.unshift(File.expand_path('test')) - require 'redgreen' - if args[:path] require args[:path] else diff --git a/bin/jammit b/bin/jammit index b38a294a..40c2f50d 100755 --- a/bin/jammit +++ b/bin/jammit @@ -1,7 +1,8 @@ -#!/usr/bin/env ruby -rrubygems +#!/usr/bin/env ruby +require 'rubygems' require 'pathname' APP_ROOT = File.dirname(Pathname.new(__FILE__).realpath) require File.join(APP_ROOT, '../lib/jammit/command_line.rb') -Jammit::CommandLine.new \ No newline at end of file +Jammit::CommandLine.new diff --git a/jammit.gemspec b/jammit.gemspec index de0349cf..e742d5a3 100644 --- a/jammit.gemspec +++ b/jammit.gemspec @@ -1,7 +1,7 @@ lib = File.expand_path('../lib/', __FILE__) $:.unshift lib unless $:.include?(lib) -require 'jammit' +require 'jammit/version' Gem::Specification.new do |s| s.name = 'jammit' diff --git a/lib/jammit.rb b/lib/jammit.rb index 5cd9615f..5b97171d 100644 --- a/lib/jammit.rb +++ b/lib/jammit.rb @@ -4,8 +4,6 @@ # to all of the configuration options. module Jammit - VERSION = "0.6.5" - ROOT = File.expand_path(File.dirname(__FILE__) + '/..') ASSET_ROOT = File.expand_path((defined?(Rails) && Rails.root.to_s.length > 0) ? Rails.root : ENV['RAILS_ROOT'] || ".") unless defined?(ASSET_ROOT) diff --git a/lib/jammit/version.rb b/lib/jammit/version.rb new file mode 100644 index 00000000..933ad51b --- /dev/null +++ b/lib/jammit/version.rb @@ -0,0 +1,3 @@ +module Jammit + VERSION = "0.6.5" +end diff --git a/test/integration/test_command_line.rb b/test/integration/test_command_line.rb index bd2fac20..4dde1ebf 100644 --- a/test/integration/test_command_line.rb +++ b/test/integration/test_command_line.rb @@ -2,6 +2,7 @@ require 'zlib' class CommandLineTest < Test::Unit::TestCase + JAMMIT = "bundle exec bin/jammit" def setup ENV['RAILS_ROOT'] = 'test' @@ -15,12 +16,12 @@ def teardown end def test_version_and_help_can_run - assert system('bin/jammit -v > /dev/null') - assert system('bin/jammit -h > /dev/null') + assert system("#{ JAMMIT } -v > /dev/null") + assert system("#{ JAMMIT } -h > /dev/null") end def test_jammit_precaching - system('bin/jammit -c test/config/assets.yml -o test/precache -u http://www.example.com') + system("#{ JAMMIT } -c test/config/assets.yml -o test/precache -u http://www.example.com") assert_equal PRECACHED_FILES, glob('test/precache/*') assert_equal zlib_read('test/precache/css_test-datauri.css.gz'), @@ -34,12 +35,12 @@ def test_jammit_precaching end def test_lazy_precaching - system('bin/jammit -c test/config/assets.yml -o test/precache -u http://www.example.com') + system("#{ JAMMIT } -c test/config/assets.yml -o test/precache -u http://www.example.com") assert_equal PRECACHED_FILES, glob('test/precache/*') mtime = File.mtime(PRECACHED_FILES.first) - system('bin/jammit -c test/config/assets.yml -o test/precache -u http://www.example.com') + system("#{ JAMMIT } -c test/config/assets.yml -o test/precache -u http://www.example.com") assert_equal File.mtime(PRECACHED_FILES.first), mtime - system('bin/jammit -c test/config/assets.yml -o test/precache -u http://www.example.com --force') + system("#{ JAMMIT } -c test/config/assets.yml -o test/precache -u http://www.example.com --force") assert File.mtime(PRECACHED_FILES.first) > mtime end From c73f2404076c4fcf5b839c874ac79ce98b99197f Mon Sep 17 00:00:00 2001 From: alunny Date: Mon, 28 Jan 2013 11:25:51 -0800 Subject: [PATCH 4/4] fix broken tests 1) mtime was not being modified when `--force` was set on command line This has now been fixed - the force option now overrides Jammit's mtime niceties 2) newlines for JSTs were improperly described in the tests - the JS file, including templates and the JST definition, have all literal newlines stripped, but newlines inside of strings (in the templates themselves) are not stripped. Since calling jammit on the CLI treats the whole output as a JS file, the fixture for the `pack_templates` unit test was not appropriate for the CLI test --- lib/jammit/command_line.rb | 2 +- lib/jammit/dependencies.rb | 1 + lib/jammit/packager.rb | 15 +++++++++++---- test/fixtures/jammed/jst_test_from_cli.js | 1 + test/integration/test_command_line.rb | 6 ++++-- 5 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 test/fixtures/jammed/jst_test_from_cli.js diff --git a/lib/jammit/command_line.rb b/lib/jammit/command_line.rb index 07e3ef19..83c8d0bf 100644 --- a/lib/jammit/command_line.rb +++ b/lib/jammit/command_line.rb @@ -81,4 +81,4 @@ def parse_options end -end \ No newline at end of file +end diff --git a/lib/jammit/dependencies.rb b/lib/jammit/dependencies.rb index 37093410..25adcdc0 100644 --- a/lib/jammit/dependencies.rb +++ b/lib/jammit/dependencies.rb @@ -49,6 +49,7 @@ # Jammit Core: require 'jsmin' require 'cssmin' +require 'jammit/version' require 'jammit/jsmin_compressor' require 'jammit/cssmin_compressor' require 'jammit/compressor' diff --git a/lib/jammit/packager.rb b/lib/jammit/packager.rb index 26cc7313..184cc4ec 100644 --- a/lib/jammit/packager.rb +++ b/lib/jammit/packager.rb @@ -33,14 +33,21 @@ def initialize # changed since their last package build. def precache_all(output_dir=nil, base_url=nil) output_dir ||= File.join(Jammit.public_root, Jammit.package_path) - cacheable(:js, output_dir).each {|p| cache(p, 'js', pack_javascripts(p), output_dir) } + + mtime = @force ? Time.now : nil + + cacheable(:js, output_dir).each do |p| + cache(p, 'js', pack_javascripts(p), output_dir, nil, mtime) + end + cacheable(:css, output_dir).each do |p| - cache(p, 'css', pack_stylesheets(p), output_dir) + cache(p, 'css', pack_stylesheets(p), output_dir, nil, mtime) + if Jammit.embed_assets - cache(p, 'css', pack_stylesheets(p, :datauri), output_dir, :datauri) + cache(p, 'css', pack_stylesheets(p, :datauri), output_dir, :datauri, mtime) if Jammit.mhtml_enabled raise MissingConfiguration, "A --base-url option is required in order to generate MHTML." unless base_url - mtime = latest_mtime package_for(p, :css)[:paths] + mtime = latest_mtime package_for(p, :css)[:paths] unless @force asset_url = "#{base_url}#{Jammit.asset_url(p, :css, :mhtml, mtime)}" cache(p, 'css', pack_stylesheets(p, :mhtml, asset_url), output_dir, :mhtml, mtime) end diff --git a/test/fixtures/jammed/jst_test_from_cli.js b/test/fixtures/jammed/jst_test_from_cli.js new file mode 100644 index 00000000..067df6c7 --- /dev/null +++ b/test/fixtures/jammed/jst_test_from_cli.js @@ -0,0 +1 @@ +(function(){window.JST=window.JST||{};var a=function(c){var b=new Function("obj","var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+c.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/<%=([\s\S]+?)%>/g,function(d,e){return"',"+e.replace(/\\'/g,"'")+",'"}).replace(/<%([\s\S]+?)%>/g,function(d,e){return"');"+e.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');");return b};window.JST.template1=a('<%= saying_something %>');window.JST.template2=a('<% _([1,2,3]).each(function(num) { %>\n
  • \n <%= num %>\n
  • \n<% }) %>')})(); \ No newline at end of file diff --git a/test/integration/test_command_line.rb b/test/integration/test_command_line.rb index 4dde1ebf..42516166 100644 --- a/test/integration/test_command_line.rb +++ b/test/integration/test_command_line.rb @@ -28,7 +28,7 @@ def test_jammit_precaching File.read('test/fixtures/jammed/css_test-datauri.css') assert_equal zlib_read('test/precache/jst_test.js.gz'), - File.read('test/fixtures/jammed/jst_test.js') + File.read('test/fixtures/jammed/jst_test_from_cli.js') assert_equal zlib_read('test/precache/js_test_with_templates.js.gz'), File.read('test/fixtures/jammed/js_test_with_templates.js') @@ -41,7 +41,9 @@ def test_lazy_precaching system("#{ JAMMIT } -c test/config/assets.yml -o test/precache -u http://www.example.com") assert_equal File.mtime(PRECACHED_FILES.first), mtime system("#{ JAMMIT } -c test/config/assets.yml -o test/precache -u http://www.example.com --force") - assert File.mtime(PRECACHED_FILES.first) > mtime + new_mtime = File.mtime(PRECACHED_FILES.first) + assert new_mtime > mtime, + "#{ PRECACHED_FILES.first } mtime - #{ new_mtime } - greater than #{ mtime }" end def zlib_read(filename)