Sha256: 004270fbae12d377530a06956336d9f57e66b5543a9434d8bd83066790ee9574

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

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

class GlobTest < UnitTest
  class App < Main
    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?("lvl1.")
    assert body.include?("lvl2.")
    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

7 entries across 7 versions & 1 rubygems

Version Path
sinatra-assetpack-0.3.5 test/glob_test.rb
sinatra-assetpack-0.3.3 test/glob_test.rb
sinatra-assetpack-0.3.2 test/glob_test.rb
sinatra-assetpack-0.3.1 test/glob_test.rb
sinatra-assetpack-0.3.0 test/glob_test.rb
sinatra-assetpack-0.2.8 test/glob_test.rb
sinatra-assetpack-0.2.7 test/glob_test.rb