roda 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +34 -0
- data/Rakefile +22 -46
- data/doc/release_notes/2.3.0.txt +109 -0
- data/lib/roda/plugins/assets.rb +2 -1
- data/lib/roda/plugins/caching.rb +1 -1
- data/lib/roda/plugins/chunked.rb +1 -1
- data/lib/roda/plugins/error_email.rb +1 -1
- data/lib/roda/plugins/head.rb +6 -0
- data/lib/roda/plugins/heartbeat.rb +40 -0
- data/lib/roda/plugins/json.rb +23 -3
- data/lib/roda/plugins/json_parser.rb +72 -0
- data/lib/roda/plugins/mailer.rb +22 -5
- data/lib/roda/plugins/named_templates.rb +2 -2
- data/lib/roda/plugins/path_rewriter.rb +82 -0
- data/lib/roda/plugins/precompile_templates.rb +87 -0
- data/lib/roda/plugins/render.rb +111 -43
- data/lib/roda/plugins/render_each.rb +1 -1
- data/lib/roda/plugins/shared_vars.rb +1 -1
- data/lib/roda/plugins/view_options.rb +28 -3
- data/lib/roda/version.rb +1 -1
- data/spec/composition_spec.rb +3 -3
- data/spec/env_spec.rb +1 -1
- data/spec/freeze_spec.rb +6 -6
- data/spec/integration_spec.rb +16 -15
- data/spec/matchers_spec.rb +110 -110
- data/spec/opts_spec.rb +8 -8
- data/spec/plugin/_erubis_escaping_spec.rb +34 -3
- data/spec/plugin/all_verbs_spec.rb +8 -8
- data/spec/plugin/assets_spec.rb +164 -150
- data/spec/plugin/backtracking_array_spec.rb +18 -18
- data/spec/plugin/caching_spec.rb +70 -70
- data/spec/plugin/chunked_spec.rb +38 -38
- data/spec/plugin/class_level_routing_spec.rb +78 -78
- data/spec/plugin/content_for_spec.rb +2 -2
- data/spec/plugin/cookies_spec.rb +4 -4
- data/spec/plugin/csrf_spec.rb +8 -8
- data/spec/plugin/default_headers_spec.rb +6 -6
- data/spec/plugin/delay_build_spec.rb +7 -6
- data/spec/plugin/delegate_spec.rb +2 -2
- data/spec/plugin/delete_empty_headers_spec.rb +2 -2
- data/spec/plugin/drop_body_spec.rb +6 -6
- data/spec/plugin/empty_root_spec.rb +3 -3
- data/spec/plugin/environments_spec.rb +7 -7
- data/spec/plugin/error_email_spec.rb +23 -23
- data/spec/plugin/error_handler_spec.rb +14 -14
- data/spec/plugin/flash_spec.rb +30 -29
- data/spec/plugin/h_spec.rb +1 -1
- data/spec/plugin/halt_spec.rb +16 -16
- data/spec/plugin/hash_matcher_spec.rb +5 -5
- data/spec/plugin/head_spec.rb +10 -10
- data/spec/plugin/header_matchers_spec.rb +13 -13
- data/spec/plugin/heartbeat_spec.rb +74 -0
- data/spec/plugin/hooks_spec.rb +20 -20
- data/spec/plugin/indifferent_params_spec.rb +1 -1
- data/spec/plugin/json_parser_spec.rb +72 -0
- data/spec/plugin/json_spec.rb +22 -9
- data/spec/plugin/mailer_spec.rb +72 -58
- data/spec/plugin/match_affix_spec.rb +2 -2
- data/spec/plugin/middleware_spec.rb +7 -7
- data/spec/plugin/module_include_spec.rb +4 -4
- data/spec/plugin/multi_route_spec.rb +66 -66
- data/spec/plugin/multi_run_spec.rb +21 -21
- data/spec/plugin/named_templates_spec.rb +6 -6
- data/spec/plugin/not_allowed_spec.rb +17 -17
- data/spec/plugin/not_found_spec.rb +14 -14
- data/spec/plugin/padrino_render_spec.rb +2 -2
- data/spec/plugin/param_matchers_spec.rb +6 -6
- data/spec/plugin/partials_spec.rb +3 -3
- data/spec/plugin/pass_spec.rb +7 -7
- data/spec/plugin/path_matchers_spec.rb +6 -6
- data/spec/plugin/path_rewriter_spec.rb +37 -0
- data/spec/plugin/path_spec.rb +41 -40
- data/spec/plugin/per_thread_caching_spec.rb +6 -6
- data/spec/plugin/precompile_templates_spec.rb +74 -0
- data/spec/plugin/render_each_spec.rb +4 -4
- data/spec/plugin/render_spec.rb +179 -76
- data/spec/plugin/shared_vars_spec.rb +4 -4
- data/spec/plugin/sinatra_helpers_spec.rb +121 -121
- data/spec/plugin/slash_path_empty_spec.rb +10 -10
- data/spec/plugin/static_spec.rb +4 -4
- data/spec/plugin/streaming_spec.rb +11 -11
- data/spec/plugin/symbol_matchers_spec.rb +24 -24
- data/spec/plugin/symbol_views_spec.rb +3 -3
- data/spec/plugin/view_options_spec.rb +10 -10
- data/spec/plugin_spec.rb +2 -2
- data/spec/redirect_spec.rb +10 -10
- data/spec/request_spec.rb +8 -8
- data/spec/response_spec.rb +23 -23
- data/spec/session_spec.rb +4 -4
- data/spec/spec_helper.rb +5 -19
- data/spec/version_spec.rb +4 -4
- data/spec/views/iv.erb +1 -0
- metadata +16 -5
data/spec/opts_spec.rb
CHANGED
@@ -4,14 +4,14 @@ describe "opts" do
|
|
4
4
|
it "is inheritable and allows overriding" do
|
5
5
|
c = Class.new(Roda)
|
6
6
|
c.opts[:foo] = "bar"
|
7
|
-
c.opts[:foo].
|
7
|
+
c.opts[:foo].must_equal "bar"
|
8
8
|
|
9
9
|
sc = Class.new(c)
|
10
|
-
sc.opts[:foo].
|
10
|
+
sc.opts[:foo].must_equal "bar"
|
11
11
|
|
12
12
|
sc.opts[:foo] = "baz"
|
13
|
-
sc.opts[:foo].
|
14
|
-
c.opts[:foo].
|
13
|
+
sc.opts[:foo].must_equal "baz"
|
14
|
+
c.opts[:foo].must_equal "bar"
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should be available as an instance methods" do
|
@@ -25,18 +25,18 @@ describe "opts" do
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
body.
|
28
|
+
body.must_equal "Hello World"
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should only shallow clone by default" do
|
32
32
|
c = Class.new(Roda)
|
33
33
|
c.opts[:foo] = "bar"
|
34
|
-
c.opts[:foo].
|
34
|
+
c.opts[:foo].must_equal "bar"
|
35
35
|
|
36
36
|
sc = Class.new(c)
|
37
37
|
sc.opts[:foo].replace("baz")
|
38
38
|
|
39
|
-
sc.opts[:foo].
|
40
|
-
c.opts[:foo].
|
39
|
+
sc.opts[:foo].must_equal "baz"
|
40
|
+
c.opts[:foo].must_equal "baz"
|
41
41
|
end
|
42
42
|
end
|
@@ -21,7 +21,7 @@ describe "_erubis_escaping plugin" do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
body.
|
24
|
+
body.must_equal '<> <>'
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should consider classes in :escape_safe_classes as safe" do
|
@@ -36,7 +36,19 @@ describe "_erubis_escaping plugin" do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
body.
|
39
|
+
body.must_equal '<> <>'
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should covnert arguments to strings when escaping with safe classes" do
|
43
|
+
app(:bare) do
|
44
|
+
plugin :render, :escape=>true, :escape_safe_classes=>[]
|
45
|
+
|
46
|
+
route do |r|
|
47
|
+
render(:inline=>'<%= :"<>" %> <%== :"<>" %><%= :"<>" if false %>')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
body.must_equal '<> <>'
|
40
52
|
end
|
41
53
|
|
42
54
|
it "should allow use of custom :escaper" do
|
@@ -52,7 +64,26 @@ describe "_erubis_escaping plugin" do
|
|
52
64
|
end
|
53
65
|
end
|
54
66
|
|
55
|
-
body.
|
67
|
+
body.must_equal "ab''1 ab'1"
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should allow for per-branch escaping via set_view options" do
|
71
|
+
app(:bare) do
|
72
|
+
plugin :render, :escape=>true
|
73
|
+
plugin :view_options
|
74
|
+
|
75
|
+
route do |r|
|
76
|
+
set_view_options :template_opts=>{:engine_class=>nil}
|
77
|
+
r.is 'a' do
|
78
|
+
set_view_options :template_opts=>{:engine_class=>render_opts[:template_opts][:engine_class]}
|
79
|
+
render(:inline=>'<%= "<>" %>')
|
80
|
+
end
|
81
|
+
render(:inline=>'<%= "<>" %>')
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
body('/a').must_equal '<>'
|
86
|
+
body.must_equal '<>'
|
56
87
|
end
|
57
88
|
end
|
58
89
|
end
|
@@ -15,15 +15,15 @@ describe "all_verbs plugin" do
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
body('REQUEST_METHOD'=>'DELETE').
|
19
|
-
body('REQUEST_METHOD'=>'HEAD').
|
20
|
-
body('REQUEST_METHOD'=>'OPTIONS').
|
21
|
-
body('REQUEST_METHOD'=>'PATCH').
|
22
|
-
body('REQUEST_METHOD'=>'PUT').
|
23
|
-
body('REQUEST_METHOD'=>'TRACE').
|
18
|
+
body('REQUEST_METHOD'=>'DELETE').must_equal 'd'
|
19
|
+
body('REQUEST_METHOD'=>'HEAD').must_equal 'h'
|
20
|
+
body('REQUEST_METHOD'=>'OPTIONS').must_equal 'o'
|
21
|
+
body('REQUEST_METHOD'=>'PATCH').must_equal 'pa'
|
22
|
+
body('REQUEST_METHOD'=>'PUT').must_equal 'pu'
|
23
|
+
body('REQUEST_METHOD'=>'TRACE').must_equal 't'
|
24
24
|
if Rack::Request.method_defined?(:link?)
|
25
|
-
body('REQUEST_METHOD'=>'LINK').
|
26
|
-
body('REQUEST_METHOD'=>'UNLINK').
|
25
|
+
body('REQUEST_METHOD'=>'LINK').must_equal 'l'
|
26
|
+
body('REQUEST_METHOD'=>'UNLINK').must_equal 'u'
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/spec/plugin/assets_spec.rb
CHANGED
@@ -2,12 +2,16 @@ require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))
|
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
4
|
begin
|
5
|
-
|
6
|
-
|
5
|
+
begin
|
6
|
+
require 'tilt/sass'
|
7
|
+
rescue LoadError
|
8
|
+
for lib in %w'tilt sass'
|
9
|
+
require lib
|
10
|
+
end
|
11
|
+
run_tests = true
|
12
|
+
rescue LoadError
|
13
|
+
warn "#{lib} not installed, skipping assets plugin test"
|
7
14
|
end
|
8
|
-
run_tests = true
|
9
|
-
rescue LoadError
|
10
|
-
warn "#{lib} not installed, skipping assets plugin test"
|
11
15
|
end
|
12
16
|
|
13
17
|
if run_tests
|
@@ -50,127 +54,128 @@ if run_tests
|
|
50
54
|
it 'assets_opts should use correct paths given options' do
|
51
55
|
fpaths = [:js_path, :css_path, :compiled_js_path, :compiled_css_path]
|
52
56
|
rpaths = [:js_prefix, :css_prefix, :compiled_js_prefix, :compiled_css_prefix]
|
53
|
-
app.assets_opts.values_at(*fpaths).
|
54
|
-
app.assets_opts.values_at(*rpaths).
|
57
|
+
app.assets_opts.values_at(*fpaths).must_equal %w"spec/assets/js/ spec/assets/css/ spec/assets/app spec/assets/app".map{|s| File.join(Dir.pwd, s)}
|
58
|
+
app.assets_opts.values_at(*rpaths).must_equal %w"assets/js/ assets/css/ assets/app assets/app"
|
55
59
|
|
56
60
|
app.plugin :assets, :path=>'bar/', :public=>'foo/', :prefix=>'as/', :js_dir=>'j/', :css_dir=>'c/', :compiled_name=>'a'
|
57
|
-
app.assets_opts.values_at(*fpaths).
|
58
|
-
app.assets_opts.values_at(*rpaths).
|
61
|
+
app.assets_opts.values_at(*fpaths).must_equal %w"bar/j/ bar/c/ foo/as/a foo/as/a".map{|s| File.join(Dir.pwd, s)}
|
62
|
+
app.assets_opts.values_at(*rpaths).must_equal %w"as/j/ as/c/ as/a as/a"
|
59
63
|
|
60
64
|
app.plugin :assets, :path=>'bar', :public=>'foo', :prefix=>'as', :js_dir=>'j', :css_dir=>'c', :compiled_name=>'a'
|
61
|
-
app.assets_opts.values_at(*fpaths).
|
62
|
-
app.assets_opts.values_at(*rpaths).
|
65
|
+
app.assets_opts.values_at(*fpaths).must_equal %w"bar/j/ bar/c/ foo/as/a foo/as/a".map{|s| File.join(Dir.pwd, s)}
|
66
|
+
app.assets_opts.values_at(*rpaths).must_equal %w"as/j/ as/c/ as/a as/a"
|
63
67
|
|
64
68
|
app.plugin :assets, :compiled_js_dir=>'cj', :compiled_css_dir=>'cs', :compiled_path=>'cp'
|
65
|
-
app.assets_opts.values_at(*fpaths).
|
66
|
-
app.assets_opts.values_at(*rpaths).
|
69
|
+
app.assets_opts.values_at(*fpaths).must_equal %w"bar/j/ bar/c/ foo/cp/cj/a foo/cp/cs/a".map{|s| File.join(Dir.pwd, s)}
|
70
|
+
app.assets_opts.values_at(*rpaths).must_equal %w"as/j/ as/c/ as/cj/a as/cs/a"
|
67
71
|
|
68
72
|
app.plugin :assets, :compiled_js_route=>'cjr', :compiled_css_route=>'ccr', :js_route=>'jr', :css_route=>'cr'
|
69
|
-
app.assets_opts.values_at(*fpaths).
|
70
|
-
app.assets_opts.values_at(*rpaths).
|
73
|
+
app.assets_opts.values_at(*fpaths).must_equal %w"bar/j/ bar/c/ foo/cp/cj/a foo/cp/cs/a".map{|s| File.join(Dir.pwd, s)}
|
74
|
+
app.assets_opts.values_at(*rpaths).must_equal %w"as/jr/ as/cr/ as/cjr/a as/ccr/a"
|
71
75
|
|
72
76
|
app.plugin :assets, :compiled_js_route=>'cj', :compiled_css_route=>'cs', :js_route=>'j', :css_route=>'c'
|
73
|
-
app.assets_opts.values_at(*fpaths).
|
74
|
-
app.assets_opts.values_at(*rpaths).
|
77
|
+
app.assets_opts.values_at(*fpaths).must_equal %w"bar/j/ bar/c/ foo/cp/cj/a foo/cp/cs/a".map{|s| File.join(Dir.pwd, s)}
|
78
|
+
app.assets_opts.values_at(*rpaths).must_equal %w"as/j/ as/c/ as/cj/a as/cs/a"
|
75
79
|
|
76
80
|
app.plugin :assets
|
77
|
-
app.assets_opts.values_at(*fpaths).
|
78
|
-
app.assets_opts.values_at(*rpaths).
|
81
|
+
app.assets_opts.values_at(*fpaths).must_equal %w"bar/j/ bar/c/ foo/cp/cj/a foo/cp/cs/a".map{|s| File.join(Dir.pwd, s)}
|
82
|
+
app.assets_opts.values_at(*rpaths).must_equal %w"as/j/ as/c/ as/cj/a as/cs/a"
|
79
83
|
|
80
84
|
app.plugin :assets, :compiled_js_dir=>'', :compiled_css_dir=>nil, :compiled_js_route=>nil, :compiled_css_route=>nil
|
81
|
-
app.assets_opts.values_at(*fpaths).
|
82
|
-
app.assets_opts.values_at(*rpaths).
|
85
|
+
app.assets_opts.values_at(*fpaths).must_equal %w"bar/j/ bar/c/ foo/cp/a foo/cp/a".map{|s| File.join(Dir.pwd, s)}
|
86
|
+
app.assets_opts.values_at(*rpaths).must_equal %w"as/j/ as/c/ as/a as/a"
|
83
87
|
|
84
88
|
app.plugin :assets, :js_dir=>'', :css_dir=>nil, :js_route=>nil, :css_route=>nil
|
85
|
-
app.assets_opts.values_at(*fpaths).
|
86
|
-
app.assets_opts.values_at(*rpaths).
|
89
|
+
app.assets_opts.values_at(*fpaths).must_equal %w"bar/ bar/ foo/cp/a foo/cp/a".map{|s| File.join(Dir.pwd, s)}
|
90
|
+
app.assets_opts.values_at(*rpaths).must_equal %w"as/ as/ as/a as/a"
|
87
91
|
|
88
92
|
app.plugin :assets, :public=>''
|
89
|
-
app.assets_opts.values_at(*fpaths).
|
90
|
-
app.assets_opts.values_at(*rpaths).
|
93
|
+
app.assets_opts.values_at(*fpaths).must_equal %w"bar/ bar/ cp/a cp/a".map{|s| File.join(Dir.pwd, s)}
|
94
|
+
app.assets_opts.values_at(*rpaths).must_equal %w"as/ as/ as/a as/a"
|
91
95
|
|
92
96
|
app.plugin :assets, :path=>'', :compiled_path=>nil
|
93
|
-
app.assets_opts.values_at(*fpaths).
|
94
|
-
app.assets_opts.values_at(*rpaths).
|
97
|
+
app.assets_opts.values_at(*fpaths).must_equal ['', '', 'a', 'a'].map{|s| File.join(Dir.pwd, s)}
|
98
|
+
app.assets_opts.values_at(*rpaths).must_equal ['as/', 'as/', 'as/a', 'as/a']
|
95
99
|
|
96
100
|
app.plugin :assets, :prefix=>''
|
97
|
-
app.assets_opts.values_at(*fpaths).
|
98
|
-
app.assets_opts.values_at(*rpaths).
|
101
|
+
app.assets_opts.values_at(*fpaths).must_equal ['', '', 'a', 'a'].map{|s| File.join(Dir.pwd, s)}
|
102
|
+
app.assets_opts.values_at(*rpaths).must_equal ['', '', 'a', 'a']
|
99
103
|
|
100
104
|
app.plugin :assets, :compiled_name=>nil
|
101
|
-
app.assets_opts.values_at(*fpaths).
|
102
|
-
app.assets_opts.values_at(*rpaths).
|
105
|
+
app.assets_opts.values_at(*fpaths).must_equal ['', ''].map{|s| File.join(Dir.pwd, s)} + ['', ''].map{|s| File.join(Dir.pwd, s).chop}
|
106
|
+
app.assets_opts.values_at(*rpaths).must_equal ['', '', '', '']
|
103
107
|
end
|
104
108
|
|
105
109
|
it 'assets_opts should use headers and dependencies given options' do
|
106
110
|
keys = [:css_headers, :js_headers, :dependencies]
|
107
|
-
app.assets_opts.values_at(*keys).
|
111
|
+
app.assets_opts.values_at(*keys).must_equal [{'Content-Type'=>"text/css; charset=UTF-8"}, {'Content-Type'=>"application/javascript; charset=UTF-8"}, {}]
|
108
112
|
|
109
113
|
app.plugin :assets, :headers=>{'A'=>'B'}, :dependencies=>{'a'=>'b'}
|
110
|
-
app.assets_opts.values_at(*keys).
|
114
|
+
app.assets_opts.values_at(*keys).must_equal [{'Content-Type'=>"text/css; charset=UTF-8", 'A'=>'B'}, {'Content-Type'=>"application/javascript; charset=UTF-8", 'A'=>'B'}, {'a'=>'b'}]
|
111
115
|
|
112
116
|
app.plugin :assets, :css_headers=>{'C'=>'D'}, :js_headers=>{'E'=>'F'}, :dependencies=>{'c'=>'d'}
|
113
|
-
app.assets_opts.values_at(*keys).
|
117
|
+
app.assets_opts.values_at(*keys).must_equal [{'Content-Type'=>"text/css; charset=UTF-8", 'A'=>'B', 'C'=>'D'}, {'Content-Type'=>"application/javascript; charset=UTF-8", 'A'=>'B', 'E'=>'F'}, {'a'=>'b', 'c'=>'d'}]
|
114
118
|
|
115
119
|
app.plugin :assets
|
116
|
-
app.assets_opts.values_at(*keys).
|
120
|
+
app.assets_opts.values_at(*keys).must_equal [{'Content-Type'=>"text/css; charset=UTF-8", 'A'=>'B', 'C'=>'D'}, {'Content-Type'=>"application/javascript; charset=UTF-8", 'A'=>'B', 'E'=>'F'}, {'a'=>'b', 'c'=>'d'}]
|
117
121
|
|
118
122
|
app.plugin :assets
|
119
|
-
app.assets_opts.values_at(*keys).
|
123
|
+
app.assets_opts.values_at(*keys).must_equal [{'Content-Type'=>"text/css; charset=UTF-8", 'A'=>'B', 'C'=>'D'}, {'Content-Type'=>"application/javascript; charset=UTF-8", 'A'=>'B', 'E'=>'F'}, {'a'=>'b', 'c'=>'d'}]
|
120
124
|
|
121
125
|
app.plugin :assets, :headers=>{'Content-Type'=>'C', 'E'=>'G'}
|
122
|
-
app.assets_opts.values_at(*keys).
|
126
|
+
app.assets_opts.values_at(*keys).must_equal [{'Content-Type'=>"C", 'A'=>'B', 'C'=>'D', 'E'=>'G'}, {'Content-Type'=>"C", 'A'=>'B', 'E'=>'F'}, {'a'=>'b', 'c'=>'d'}]
|
123
127
|
|
124
128
|
app.plugin :assets, :css_headers=>{'A'=>'B1'}, :js_headers=>{'E'=>'F1'}, :dependencies=>{'c'=>'d1'}
|
125
|
-
app.assets_opts.values_at(*keys).
|
129
|
+
app.assets_opts.values_at(*keys).must_equal [{'Content-Type'=>"C", 'A'=>'B1', 'C'=>'D', 'E'=>'G'}, {'Content-Type'=>"C", 'A'=>'B', 'E'=>'F1'}, {'a'=>'b', 'c'=>'d1'}]
|
126
130
|
end
|
127
131
|
|
128
132
|
it 'should handle rendering assets, linking to them, and accepting requests for them when not compiling' do
|
129
133
|
html = body('/test')
|
130
|
-
html.scan(/<link/).length.
|
134
|
+
html.scan(/<link/).length.must_equal 2
|
131
135
|
html =~ %r{href="(/assets/css/app\.scss)"}
|
132
136
|
css = body($1)
|
133
137
|
html =~ %r{href="(/assets/css/raw\.css)"}
|
134
138
|
css2 = body($1)
|
135
|
-
html.scan(/<script/).length.
|
139
|
+
html.scan(/<script/).length.must_equal 1
|
136
140
|
html =~ %r{src="(/assets/js/head/app\.js)"}
|
137
141
|
js = body($1)
|
138
|
-
css.
|
139
|
-
css2.
|
140
|
-
js.
|
142
|
+
css.must_match(/color: red;/)
|
143
|
+
css2.must_match(/color: blue;/)
|
144
|
+
js.must_include('console.log')
|
141
145
|
end
|
142
146
|
|
143
147
|
it 'should handle rendering assets, linking to them, and accepting requests for them when :add_script_name app option is used' do
|
144
148
|
app.opts[:add_script_name] = true
|
145
149
|
app.plugin :assets
|
146
150
|
html = body('/test', 'SCRIPT_NAME'=>'/foo')
|
147
|
-
html.scan(/<link/).length.
|
151
|
+
html.scan(/<link/).length.must_equal 2
|
148
152
|
html =~ %r{href="/foo(/assets/css/app\.scss)"}
|
149
153
|
css = body($1)
|
150
154
|
html =~ %r{href="/foo(/assets/css/raw\.css)"}
|
151
155
|
css2 = body($1)
|
152
|
-
html.scan(/<script/).length.
|
156
|
+
html.scan(/<script/).length.must_equal 1
|
153
157
|
html =~ %r{src="/foo(/assets/js/head/app\.js)"}
|
154
158
|
js = body($1)
|
155
|
-
css.
|
156
|
-
css2.
|
159
|
+
css.must_match(/color: red;/)
|
160
|
+
css2.must_match(/color: blue;/)
|
161
|
+
js.must_include('console.log')
|
157
162
|
end
|
158
163
|
|
159
164
|
it 'should handle rendering assets, linking to them, and accepting requests for them when not compiling, with different options' do
|
160
165
|
app.plugin :assets, :path=>'spec/', :js_dir=>'assets/js', :css_dir=>'assets/css', :prefix=>'a',
|
161
166
|
:js_route=>'foo', :css_route=>'bar', :add_suffix=>true, :css_opts=>{:style=>:compressed}
|
162
167
|
html = body('/test')
|
163
|
-
html.scan(/<link/).length.
|
168
|
+
html.scan(/<link/).length.must_equal 2
|
164
169
|
html =~ %r{href="(/a/bar/app\.scss.css)"}
|
165
170
|
css = body($1)
|
166
171
|
html =~ %r{href="(/a/bar/raw\.css.css)"}
|
167
172
|
css2 = body($1)
|
168
|
-
html.scan(/<script/).length.
|
173
|
+
html.scan(/<script/).length.must_equal 1
|
169
174
|
html =~ %r{src="(/a/foo/head/app\.js.js)"}
|
170
175
|
js = body($1)
|
171
|
-
css.
|
172
|
-
css2.
|
173
|
-
js.
|
176
|
+
css.must_match(/color:red\}/)
|
177
|
+
css2.must_match(/color: blue;/)
|
178
|
+
js.must_include('console.log')
|
174
179
|
end
|
175
180
|
|
176
181
|
it 'should handle rendering assets, linking to them, and accepting requests for them when not compiling with a multi-level hash' do
|
@@ -183,17 +188,17 @@ if run_tests
|
|
183
188
|
end
|
184
189
|
end
|
185
190
|
html = body('/test')
|
186
|
-
html.scan(/<link/).length.
|
191
|
+
html.scan(/<link/).length.must_equal 2
|
187
192
|
html =~ %r{href="(/assets/css/app\.scss)"}
|
188
193
|
css = body($1)
|
189
194
|
html =~ %r{href="(/assets/css/raw\.css)"}
|
190
195
|
css2 = body($1)
|
191
|
-
html.scan(/<script/).length.
|
196
|
+
html.scan(/<script/).length.must_equal 1
|
192
197
|
html =~ %r{src="(/assets/js/head/app\.js)"}
|
193
198
|
js = body($1)
|
194
|
-
css.
|
195
|
-
css2.
|
196
|
-
js.
|
199
|
+
css.must_match(/color: red;/)
|
200
|
+
css2.must_match(/color: blue;/)
|
201
|
+
js.must_include('console.log')
|
197
202
|
end
|
198
203
|
|
199
204
|
it 'should handle :group_subdirs => false' do
|
@@ -206,31 +211,31 @@ if run_tests
|
|
206
211
|
end
|
207
212
|
end
|
208
213
|
html = body('/test')
|
209
|
-
html.scan(/<link/).length.
|
214
|
+
html.scan(/<link/).length.must_equal 2
|
210
215
|
html =~ %r{href="(/assets/css/app\.scss)"}
|
211
216
|
css = body($1)
|
212
217
|
html =~ %r{href="(/assets/css/raw\.css)"}
|
213
218
|
css2 = body($1)
|
214
|
-
html.scan(/<script/).length.
|
219
|
+
html.scan(/<script/).length.must_equal 1
|
215
220
|
html =~ %r{src="(/assets/js/head/app\.js)"}
|
216
221
|
js = body($1)
|
217
|
-
css.
|
218
|
-
css2.
|
219
|
-
js.
|
222
|
+
css.must_match(/color: red;/)
|
223
|
+
css2.must_match(/color: blue;/)
|
224
|
+
js.must_include('console.log')
|
220
225
|
end
|
221
226
|
|
222
227
|
it 'should handle compiling assets, linking to them, and accepting requests for them' do
|
223
228
|
app.compile_assets
|
224
229
|
html = body('/test')
|
225
|
-
html.scan(/<link/).length.
|
230
|
+
html.scan(/<link/).length.must_equal 1
|
226
231
|
html =~ %r{href="(/assets/app\.[a-f0-9]{40}\.css)"}
|
227
232
|
css = body($1)
|
228
|
-
html.scan(/<script/).length.
|
233
|
+
html.scan(/<script/).length.must_equal 1
|
229
234
|
html =~ %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
|
230
235
|
js = body($1)
|
231
|
-
css.
|
232
|
-
css.
|
233
|
-
js.
|
236
|
+
css.must_match(/color: ?red/)
|
237
|
+
css.must_match(/color: ?blue/)
|
238
|
+
js.must_include('console.log')
|
234
239
|
end
|
235
240
|
|
236
241
|
it 'should handle compiling assets, linking to them, and accepting requests for them when :add_script_name app option is used' do
|
@@ -240,12 +245,12 @@ if run_tests
|
|
240
245
|
html = body('/test', 'SCRIPT_NAME'=>'/foo')
|
241
246
|
html =~ %r{href="/foo(/assets/app\.[a-f0-9]{40}\.css)"}
|
242
247
|
css = body($1)
|
243
|
-
html.scan(/<script/).length.
|
248
|
+
html.scan(/<script/).length.must_equal 1
|
244
249
|
html =~ %r{src="/foo(/assets/app\.head\.[a-f0-9]{40}\.js)"}
|
245
250
|
js = body($1)
|
246
|
-
css.
|
247
|
-
css.
|
248
|
-
js.
|
251
|
+
css.must_match(/color: ?red/)
|
252
|
+
css.must_match(/color: ?blue/)
|
253
|
+
js.must_include('console.log')
|
249
254
|
end
|
250
255
|
|
251
256
|
it 'should handle compiling assets, linking to them, and accepting requests for them, with different options' do
|
@@ -253,15 +258,15 @@ if run_tests
|
|
253
258
|
:public=>'spec/assets', :path=>'spec', :compiled_js_route=>'foo', :compiled_css_route=>'bar'
|
254
259
|
app.compile_assets
|
255
260
|
html = body('/test')
|
256
|
-
html.scan(/<link/).length.
|
261
|
+
html.scan(/<link/).length.must_equal 1
|
257
262
|
html =~ %r{href="(/a/bar/app\.[a-f0-9]{40}\.css)"}
|
258
263
|
css = body($1)
|
259
|
-
html.scan(/<script/).length.
|
264
|
+
html.scan(/<script/).length.must_equal 1
|
260
265
|
html =~ %r{src="(/a/foo/app\.head\.[a-f0-9]{40}\.js)"}
|
261
266
|
js = body($1)
|
262
|
-
css.
|
263
|
-
css.
|
264
|
-
js.
|
267
|
+
css.must_match(/color: ?red/)
|
268
|
+
css.must_match(/color: ?blue/)
|
269
|
+
js.must_include('console.log')
|
265
270
|
end
|
266
271
|
|
267
272
|
it 'should handle rendering assets, linking to them, and accepting requests for them when not compiling with a multi-level hash' do
|
@@ -275,15 +280,15 @@ if run_tests
|
|
275
280
|
end
|
276
281
|
end
|
277
282
|
html = body('/test')
|
278
|
-
html.scan(/<link/).length.
|
283
|
+
html.scan(/<link/).length.must_equal 1
|
279
284
|
html =~ %r{href="(/assets/app\.assets\.css\.[a-f0-9]{40}\.css)"}
|
280
285
|
css = body($1)
|
281
|
-
html.scan(/<script/).length.
|
286
|
+
html.scan(/<script/).length.must_equal 1
|
282
287
|
html =~ %r{src="(/assets/app\.assets\.js\.head\.[a-f0-9]{40}\.js)"}
|
283
288
|
js = body($1)
|
284
|
-
css.
|
285
|
-
css.
|
286
|
-
js.
|
289
|
+
css.must_match(/color: ?red/)
|
290
|
+
css.must_match(/color: ?blue/)
|
291
|
+
js.must_include('console.log')
|
287
292
|
end
|
288
293
|
|
289
294
|
it 'should handle rendering assets, linking to them, and accepting requests for them when not compiling with a multi-level hash when :add_script_name app option is used' do
|
@@ -298,15 +303,15 @@ if run_tests
|
|
298
303
|
end
|
299
304
|
end
|
300
305
|
html = body('/test', 'SCRIPT_NAME'=>'/foo')
|
301
|
-
html.scan(/<link/).length.
|
306
|
+
html.scan(/<link/).length.must_equal 1
|
302
307
|
html =~ %r{href="/foo(/assets/app\.assets\.css\.[a-f0-9]{40}\.css)"}
|
303
308
|
css = body($1)
|
304
|
-
html.scan(/<script/).length.
|
309
|
+
html.scan(/<script/).length.must_equal 1
|
305
310
|
html =~ %r{src="/foo(/assets/app\.assets\.js\.head\.[a-f0-9]{40}\.js)"}
|
306
311
|
js = body($1)
|
307
|
-
css.
|
308
|
-
css.
|
309
|
-
js.
|
312
|
+
css.must_match(/color: ?red/)
|
313
|
+
css.must_match(/color: ?blue/)
|
314
|
+
js.must_include('console.log')
|
310
315
|
end
|
311
316
|
|
312
317
|
it 'should handle :group_subdirs => false when compiling' do
|
@@ -320,189 +325,198 @@ if run_tests
|
|
320
325
|
end
|
321
326
|
end
|
322
327
|
html = body('/test')
|
323
|
-
html.scan(/<link/).length.
|
328
|
+
html.scan(/<link/).length.must_equal 1
|
324
329
|
html =~ %r{href="(/assets/app\.assets\.css\.[a-f0-9]{40}\.css)"}
|
325
330
|
css = body($1)
|
326
|
-
html.scan(/<script/).length.
|
331
|
+
html.scan(/<script/).length.must_equal 1
|
327
332
|
html =~ %r{src="(/assets/app\.assets\.js\.head\.[a-f0-9]{40}\.js)"}
|
328
333
|
js = body($1)
|
329
|
-
css.
|
330
|
-
css.
|
331
|
-
js.
|
334
|
+
css.must_match(/color: ?red/)
|
335
|
+
css.must_match(/color: ?blue/)
|
336
|
+
js.must_include('console.log')
|
332
337
|
end
|
333
338
|
|
334
339
|
it 'should handle automatically creating directories when compiling assets' do
|
335
340
|
app.plugin :assets, :public=>'spec/public'
|
336
341
|
app.compile_assets
|
337
342
|
html = body('/test')
|
338
|
-
html.scan(/<link/).length.
|
343
|
+
html.scan(/<link/).length.must_equal 1
|
339
344
|
html =~ %r{href="(/assets/app\.[a-f0-9]{40}\.css)"}
|
340
345
|
css = body($1)
|
341
|
-
html.scan(/<script/).length.
|
346
|
+
html.scan(/<script/).length.must_equal 1
|
342
347
|
html =~ %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
|
343
348
|
js = body($1)
|
344
|
-
css.
|
345
|
-
css.
|
346
|
-
js.
|
349
|
+
css.must_match(/color: ?red/)
|
350
|
+
css.must_match(/color: ?blue/)
|
351
|
+
js.must_include('console.log')
|
347
352
|
end
|
348
353
|
|
349
354
|
it 'should handle compiling only css assets' do
|
350
355
|
app.compile_assets(:css)
|
351
356
|
html = body('/test')
|
352
|
-
html.scan(/<link/).length.
|
357
|
+
html.scan(/<link/).length.must_equal 1
|
353
358
|
html =~ %r{href="(/assets/app\.[a-f0-9]{40}\.css)"}
|
354
359
|
css = body($1)
|
355
|
-
html.scan(/<script/).length.
|
356
|
-
css.
|
357
|
-
css.
|
360
|
+
html.scan(/<script/).length.must_equal 0
|
361
|
+
css.must_match(/color: ?red/)
|
362
|
+
css.must_match(/color: ?blue/)
|
358
363
|
end
|
359
364
|
|
360
365
|
it 'should handle compiling only js assets' do
|
361
366
|
app.compile_assets(:js)
|
362
367
|
html = body('/test')
|
363
|
-
html.scan(/<link/).length.
|
364
|
-
html.scan(/<script/).length.
|
368
|
+
html.scan(/<link/).length.must_equal 0
|
369
|
+
html.scan(/<script/).length.must_equal 1
|
365
370
|
html =~ %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
|
366
371
|
js = body($1)
|
367
|
-
js.
|
372
|
+
js.must_include('console.log')
|
368
373
|
end
|
369
374
|
|
370
375
|
it 'should handle compiling asset subfolders' do
|
371
376
|
app.compile_assets([:js, :head])
|
372
377
|
html = body('/test')
|
373
|
-
html.scan(/<link/).length.
|
374
|
-
html.scan(/<script/).length.
|
378
|
+
html.scan(/<link/).length.must_equal 0
|
379
|
+
html.scan(/<script/).length.must_equal 1
|
375
380
|
html =~ %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
|
376
381
|
js = body($1)
|
377
|
-
js.
|
382
|
+
js.must_include('console.log')
|
378
383
|
end
|
379
384
|
|
380
385
|
it 'should handle compiling assets when only a single asset type is present' do
|
381
386
|
app.plugin :assets, :css=>nil
|
382
387
|
app.compile_assets
|
383
388
|
html = body('/test')
|
384
|
-
html.scan(/<link/).length.
|
385
|
-
html.scan(/<script/).length.
|
389
|
+
html.scan(/<link/).length.must_equal 0
|
390
|
+
html.scan(/<script/).length.must_equal 1
|
386
391
|
html =~ %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
|
387
392
|
js = body($1)
|
388
|
-
js.
|
393
|
+
js.must_include('console.log')
|
389
394
|
end
|
390
395
|
|
391
396
|
it 'should handle compiling assets when an empty array is used' do
|
392
397
|
app.plugin :assets, :css=>[]
|
393
398
|
app.compile_assets
|
394
399
|
html = body('/test')
|
395
|
-
html.scan(/<link/).length.
|
396
|
-
html.scan(/<script/).length.
|
400
|
+
html.scan(/<link/).length.must_equal 0
|
401
|
+
html.scan(/<script/).length.must_equal 1
|
397
402
|
html =~ %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
|
398
403
|
js = body($1)
|
399
|
-
js.
|
404
|
+
js.must_include('console.log')
|
400
405
|
end
|
401
406
|
|
402
|
-
it '#assets
|
403
|
-
app.allocate.assets([:js, :head], 'a'=>'b').
|
407
|
+
it '#assets must_include attributes given' do
|
408
|
+
app.allocate.assets([:js, :head], 'a'=>'b').must_equal '<script type="text/javascript" a="b" src="/assets/js/head/app.js"></script>'
|
404
409
|
end
|
405
410
|
|
406
411
|
it '#assets should escape attribute values given' do
|
407
|
-
app.allocate.assets([:js, :head], 'a'=>'b"e').
|
412
|
+
app.allocate.assets([:js, :head], 'a'=>'b"e').must_equal '<script type="text/javascript" a="b"e" src="/assets/js/head/app.js"></script>'
|
408
413
|
end
|
409
414
|
|
410
415
|
it 'requests for assets should return 304 if the asset has not been modified' do
|
411
416
|
loc = '/assets/js/head/app.js'
|
412
417
|
lm = header('Last-Modified', loc)
|
413
|
-
status(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).
|
414
|
-
body(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).
|
418
|
+
status(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).must_equal 304
|
419
|
+
body(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).must_equal ''
|
415
420
|
end
|
416
421
|
|
417
422
|
it 'requests for assets should not return 304 if the asset has been modified' do
|
418
423
|
loc = '/assets/js/head/app.js'
|
419
424
|
lm = header('Last-Modified', loc)
|
420
425
|
File.utime(js_atime, js_mtime+1, js_file)
|
421
|
-
status(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).
|
422
|
-
body(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).
|
426
|
+
status(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).must_equal 200
|
427
|
+
body(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).must_include('console.log')
|
423
428
|
end
|
424
429
|
|
425
430
|
it 'requests for assets should return 304 if the dependency of an asset has not been modified' do
|
426
431
|
app.plugin :assets, :dependencies=>{js_file=>css_file}
|
427
432
|
loc = '/assets/js/head/app.js'
|
428
433
|
lm = header('Last-Modified', loc)
|
429
|
-
status(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).
|
430
|
-
body(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).
|
434
|
+
status(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).must_equal 304
|
435
|
+
body(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).must_equal ''
|
431
436
|
end
|
432
437
|
|
433
438
|
it 'requests for assets should return 200 if the dependency of an asset has been modified' do
|
434
439
|
app.plugin :assets, :dependencies=>{js_file=>css_file}
|
435
440
|
loc = '/assets/js/head/app.js'
|
436
441
|
lm = header('Last-Modified', loc)
|
437
|
-
File.utime(css_atime, [css_mtime+
|
438
|
-
status(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).
|
439
|
-
body(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).
|
442
|
+
File.utime(css_atime, [css_mtime+2, js_mtime+2].max, css_file)
|
443
|
+
status(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).must_equal 200
|
444
|
+
body(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).must_include('console.log')
|
440
445
|
end
|
441
446
|
|
442
447
|
it 'should do a terminal match for assets' do
|
443
|
-
status('/assets/css/app.scss/foo').
|
448
|
+
status('/assets/css/app.scss/foo').must_equal 404
|
444
449
|
end
|
445
450
|
|
446
451
|
it 'should only allow files that you specify' do
|
447
|
-
status('/assets/css/no_access.css').
|
452
|
+
status('/assets/css/no_access.css').must_equal 404
|
448
453
|
end
|
449
454
|
|
450
455
|
it 'should not add routes for empty asset types' do
|
451
456
|
app.plugin :assets, :css=>nil
|
452
457
|
a = app::RodaRequest.assets_matchers
|
453
|
-
a.length.
|
454
|
-
a.first.length.
|
455
|
-
a.first.first.
|
456
|
-
'assets/js/head/app.js'.
|
457
|
-
'assets/js/head/app2.js'.
|
458
|
+
a.length.must_equal 1
|
459
|
+
a.first.length.must_equal 2
|
460
|
+
a.first.first.must_equal 'js'
|
461
|
+
'assets/js/head/app.js'.must_match a.first.last
|
462
|
+
'assets/js/head/app2.js'.wont_match a.first.last
|
458
463
|
end
|
459
464
|
|
460
465
|
it 'should not add routes if no asset types' do
|
461
466
|
app.plugin :assets, :js=>nil, :css=>nil
|
462
|
-
app::RodaRequest.assets_matchers.
|
467
|
+
app::RodaRequest.assets_matchers.must_equal []
|
463
468
|
end
|
464
469
|
|
465
470
|
it 'should support :precompiled option' do
|
466
471
|
app.plugin :assets, :precompiled=>metadata_file
|
467
|
-
File.exist?(metadata_file).
|
468
|
-
app.allocate.assets([:js, :head]).
|
472
|
+
File.exist?(metadata_file).must_equal false
|
473
|
+
app.allocate.assets([:js, :head]).must_equal '<script type="text/javascript" src="/assets/js/head/app.js"></script>'
|
469
474
|
|
470
475
|
app.compile_assets
|
471
|
-
File.exist?(metadata_file).
|
472
|
-
app.allocate.assets([:js, :head]).
|
476
|
+
File.exist?(metadata_file).must_equal true
|
477
|
+
app.allocate.assets([:js, :head]).must_match %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
|
473
478
|
|
474
479
|
app.plugin :assets, :compiled=>false, :precompiled=>false
|
475
|
-
app.allocate.assets([:js, :head]).
|
480
|
+
app.allocate.assets([:js, :head]).must_equal '<script type="text/javascript" src="/assets/js/head/app.js"></script>'
|
476
481
|
|
477
482
|
app.plugin :assets, :precompiled=>metadata_file
|
478
|
-
app.allocate.assets([:js, :head]).
|
483
|
+
app.allocate.assets([:js, :head]).must_match %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
|
484
|
+
end
|
485
|
+
|
486
|
+
it 'should work correctly with json plugin when r.assets is the last method called' do
|
487
|
+
app.plugin :assets
|
488
|
+
app.plugin :json
|
489
|
+
app.route do |r|
|
490
|
+
r.assets
|
491
|
+
end
|
492
|
+
status.must_equal 404
|
479
493
|
end
|
480
494
|
end
|
481
495
|
|
482
496
|
describe 'assets plugin' do
|
483
497
|
it "app :root option affects :views default" do
|
484
498
|
app.plugin :assets
|
485
|
-
app.assets_opts[:path].
|
486
|
-
app.assets_opts[:js_path].
|
487
|
-
app.assets_opts[:css_path].
|
499
|
+
app.assets_opts[:path].must_equal File.join(Dir.pwd, 'assets')
|
500
|
+
app.assets_opts[:js_path].must_equal File.join(Dir.pwd, 'assets/js/')
|
501
|
+
app.assets_opts[:css_path].must_equal File.join(Dir.pwd, 'assets/css/')
|
488
502
|
|
489
503
|
app.opts[:root] = '/foo'
|
490
504
|
app.plugin :assets
|
491
|
-
app.assets_opts[:path].
|
492
|
-
app.assets_opts[:js_path].
|
493
|
-
app.assets_opts[:css_path].
|
505
|
+
app.assets_opts[:path].must_equal '/foo/assets'
|
506
|
+
app.assets_opts[:js_path].must_equal '/foo/assets/js/'
|
507
|
+
app.assets_opts[:css_path].must_equal '/foo/assets/css/'
|
494
508
|
|
495
509
|
app.opts[:root] = '/foo/bar'
|
496
510
|
app.plugin :assets
|
497
|
-
app.assets_opts[:path].
|
498
|
-
app.assets_opts[:js_path].
|
499
|
-
app.assets_opts[:css_path].
|
511
|
+
app.assets_opts[:path].must_equal '/foo/bar/assets'
|
512
|
+
app.assets_opts[:js_path].must_equal '/foo/bar/assets/js/'
|
513
|
+
app.assets_opts[:css_path].must_equal '/foo/bar/assets/css/'
|
500
514
|
|
501
515
|
app.opts[:root] = nil
|
502
516
|
app.plugin :assets
|
503
|
-
app.assets_opts[:path].
|
504
|
-
app.assets_opts[:js_path].
|
505
|
-
app.assets_opts[:css_path].
|
517
|
+
app.assets_opts[:path].must_equal File.join(Dir.pwd, 'assets')
|
518
|
+
app.assets_opts[:js_path].must_equal File.join(Dir.pwd, 'assets/js/')
|
519
|
+
app.assets_opts[:css_path].must_equal File.join(Dir.pwd, 'assets/css/')
|
506
520
|
end
|
507
521
|
end
|
508
522
|
end
|