forked from rstacruz/sinatra-assetpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglob_test.rb
45 lines (39 loc) · 1.1 KB
/
glob_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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