Sha256: 06468c634a1d4dd3a30a85eda5f9bf33b99271e2b8cc6b530441448f9c8b5adb

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require File.expand_path('../test_helper', __FILE__)

class BuildTest < UnitTest
  teardown do
    FileUtils.rm_rf app.public
  end

  test "build" do
    Stylus.expects(:compile).returns("body{background:#f00;color:#00f;}")
    app.assets.css_compression = :simple
    app.assets.build!

    assert File.file? File.join(app.root, 'public/js/app.js')
    assert File.mtime(File.join(app.root, 'public/js/app.js')).to_i == app.assets.packages['app.js'].mtime.to_i

    assert Dir[File.join(app.root, 'public/js/app.*.js')].first

    assert File.read(File.join(app.root, 'public/js/app.js')).include?('function(){alert("Hello");')

    assert Dir["#{app.root}/public/images/background.*.jpg"].first
    assert Dir["#{app.root}/public/images/email.*.png"].first

    assert \
      File.mtime(Dir["#{app.root}/public/images/background.*.jpg"].first).to_i ==
      File.mtime(Dir["#{app.root}/public/images/background.jpg"].first).to_i

    assert \
      File.mtime(Dir["#{app.root}/public/images/background.*.jpg"].first).to_i ==
      File.mtime(Dir["#{app.root}/app/images/background.jpg"].first).to_i
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sinatra-assetpack-0.0.10 test/build_test.rb