Sha256: 6051054c43f64bd8e01f4a2cc20f32efcd19c647adea07285328b798722ae5a6

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

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
    app.stubs(:development?).returns(true)
    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
    app.stubs(:development?).returns(true)
    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
    app.stubs(:development?).returns(true)
    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

8 entries across 8 versions & 2 rubygems

Version Path
sinatra-assetpack-0.2.2 test/glob_test.rb
sinatra-assetpack-0.2.1 test/glob_test.rb
sinatra-assetpack-0.2.0 test/glob_test.rb
sinatra-assetpack-0.1.7 test/glob_test.rb
sundawg-sinatra-assetpack-fork-0.1.6 test/glob_test.rb
sinatra-assetpack-0.1.6 test/glob_test.rb
sinatra-assetpack-0.1.5 test/glob_test.rb
sinatra-assetpack-0.1.4 test/glob_test.rb