Sha256: 5c7b05f2a27f1787022a5476f73f03114c25af46f25bdd2fd46de9235f85e5f4

Contents?: true

Size: 969 Bytes

Versions: 10

Compression:

Stored size: 969 Bytes

Contents

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

class GlobTest < UnitTest
  class App < UnitTest::App
    register Sinatra::AssetPack

    assets {
      serve '/js', :from => 'app/js_glob'
      js :a, '/a.js', [ '/js/**/*.js' ]
      js :b, '/b.js', [ '/js/a/b/c2/*.js' ]
      js :c, '/c.js', [ '/js/a/b/*/*.js' ]
    }

    get('/a') { js :a }
    get('/b') { js :b }
    get('/c') { js :c }
  end

  def app
    App
  end

  should "match double-star globs recursively" do
    get '/a'
    assert body.include?("a/b/c1/hello.")
    assert body.include?("a/b/c2/hi.")
    assert body.include?("a/b/c2/hola.")
  end

  should "match single-star globs in filenames" do
    get '/b'
    assert body.include?("a/b/c2/hi.")
    assert body.include?("a/b/c2/hola.")
  end

  should "match single-star globs in paths" do
    get '/c'
    assert body.include?("a/b/c1/hello.")
    assert body.include?("a/b/c2/hi.")
    assert body.include?("a/b/c2/hola.")
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
sinatra-assetpack-0.1.3 test/glob_test.rb
sinatra-assetpack-0.1.2 test/glob_test.rb
sinatra-assetpack-0.1.1 test/glob_test.rb
sinatra-assetpack-0.1.0 test/glob_test.rb
sinatra-assetpack-flexible-compression-0.0.1 test/glob_test.rb
sundawg-sinatra-assetpack-fork-0.0.12.pre1 test/glob_test.rb
sinatra-assetpack-0.0.12.pre1 test/glob_test.rb
sinatra-assetpack-0.0.11 test/glob_test.rb
sinatra-assetpack-0.0.10 test/glob_test.rb
sinatra-assetpack-0.0.9 test/glob_test.rb