Sha256: 599f9cb7e94e03878eb0305a585d1783656474fccf5c33472398e30fa4a8aa51

Contents?: true

Size: 1.02 KB

Versions: 11

Compression:

Stored size: 1.02 KB

Contents

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

class NonExistentTest < UnitTest
  class App < Main
    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

  test "non-existant asset hosts" do
    file = File.join(app.root, 'app/js/hello.js')

    assert_equal(app.root + '/app/js/hello.js', Sinatra::AssetPack::HtmlHelpers.get_file_uri(file, App.assets))
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sinatra-assetpack-0.3.5 test/non_existent_test.rb
sinatra-assetpack-0.3.3 test/non_existent_test.rb
sinatra-assetpack-0.3.2 test/non_existent_test.rb
sinatra-assetpack-0.3.1 test/non_existent_test.rb
sinatra-assetpack-0.3.0 test/non_existent_test.rb
sinatra-assetpack-0.2.8 test/non_existent_test.rb
sinatra-assetpack-0.2.7 test/non_existent_test.rb
sinatra-assetpack-0.2.6 test/non_existent_test.rb
sinatra-assetpack-0.2.5 test/non_existent_test.rb
sinatra-assetpack-0.2.4 test/non_existent_test.rb
sinatra-assetpack-0.2.3 test/non_existent_test.rb