Sha256: 5071e16650a8f0be7136a54843a55a8a03c24ce3faa44e4c0f7e6f661f6f1837

Contents?: true

Size: 927 Bytes

Versions: 1

Compression:

Stored size: 927 Bytes

Contents

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

class NonExistentTest < UnitTest
  class App < Sinatra::Base
    set :root, File.expand_path('../app', __FILE__)
    register Sinatra::AssetPack

    assets do |a|
      a.js :script, '/script.min.js', [
        '/js/h*.js',
        '/js/combine.js'
      ]

      a.js_compression :closure
      a.css_compression = :yui
    end

    get '/js/combine.js' do
      "alert('Spin spin sugar');"
    end

    get '/' do
      js :script
    end
  end

  def app
    App
  end

  test "non-existent files in js helper" do
    get '/'
    assert body.include?('combine.js')
  end

  test "dev non-existent files in js helper" do
    App.expects(:environment).returns(:development).times(1..100)
    get '/'
    assert body.include?('combine.js')
  end

  test "non-existent files in js minifier" do
    get '/script.min.js'
    assert body.include?('Spin spin sugar')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sinatra-assetpack-0.0.8 test/non_existent_test.rb