Sha256: a22b6142b9f5bd97f68477a9fc95430a4872b03c3d04f98965345e0d50b60608

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

require 'test_helper'
require 'zlib'

class CommandLineTest < Test::Unit::TestCase

  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/test-datauri.css.gz') {|f| f.read } == File.read('test/fixtures/jammed/test-datauri.css')
    assert Zlib::GzipReader.open('test/precache/test.jst.gz') {|f| f.read } == File.read('test/fixtures/jammed/test.jst')
    FileUtils.rm_r('test/precache')
  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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jammit-core-0.1.1 test/unit/command_line_test.rb
jammit-core-0.1.0 test/unit/command_line_test.rb