roda 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +34 -0
  3. data/Rakefile +22 -46
  4. data/doc/release_notes/2.3.0.txt +109 -0
  5. data/lib/roda/plugins/assets.rb +2 -1
  6. data/lib/roda/plugins/caching.rb +1 -1
  7. data/lib/roda/plugins/chunked.rb +1 -1
  8. data/lib/roda/plugins/error_email.rb +1 -1
  9. data/lib/roda/plugins/head.rb +6 -0
  10. data/lib/roda/plugins/heartbeat.rb +40 -0
  11. data/lib/roda/plugins/json.rb +23 -3
  12. data/lib/roda/plugins/json_parser.rb +72 -0
  13. data/lib/roda/plugins/mailer.rb +22 -5
  14. data/lib/roda/plugins/named_templates.rb +2 -2
  15. data/lib/roda/plugins/path_rewriter.rb +82 -0
  16. data/lib/roda/plugins/precompile_templates.rb +87 -0
  17. data/lib/roda/plugins/render.rb +111 -43
  18. data/lib/roda/plugins/render_each.rb +1 -1
  19. data/lib/roda/plugins/shared_vars.rb +1 -1
  20. data/lib/roda/plugins/view_options.rb +28 -3
  21. data/lib/roda/version.rb +1 -1
  22. data/spec/composition_spec.rb +3 -3
  23. data/spec/env_spec.rb +1 -1
  24. data/spec/freeze_spec.rb +6 -6
  25. data/spec/integration_spec.rb +16 -15
  26. data/spec/matchers_spec.rb +110 -110
  27. data/spec/opts_spec.rb +8 -8
  28. data/spec/plugin/_erubis_escaping_spec.rb +34 -3
  29. data/spec/plugin/all_verbs_spec.rb +8 -8
  30. data/spec/plugin/assets_spec.rb +164 -150
  31. data/spec/plugin/backtracking_array_spec.rb +18 -18
  32. data/spec/plugin/caching_spec.rb +70 -70
  33. data/spec/plugin/chunked_spec.rb +38 -38
  34. data/spec/plugin/class_level_routing_spec.rb +78 -78
  35. data/spec/plugin/content_for_spec.rb +2 -2
  36. data/spec/plugin/cookies_spec.rb +4 -4
  37. data/spec/plugin/csrf_spec.rb +8 -8
  38. data/spec/plugin/default_headers_spec.rb +6 -6
  39. data/spec/plugin/delay_build_spec.rb +7 -6
  40. data/spec/plugin/delegate_spec.rb +2 -2
  41. data/spec/plugin/delete_empty_headers_spec.rb +2 -2
  42. data/spec/plugin/drop_body_spec.rb +6 -6
  43. data/spec/plugin/empty_root_spec.rb +3 -3
  44. data/spec/plugin/environments_spec.rb +7 -7
  45. data/spec/plugin/error_email_spec.rb +23 -23
  46. data/spec/plugin/error_handler_spec.rb +14 -14
  47. data/spec/plugin/flash_spec.rb +30 -29
  48. data/spec/plugin/h_spec.rb +1 -1
  49. data/spec/plugin/halt_spec.rb +16 -16
  50. data/spec/plugin/hash_matcher_spec.rb +5 -5
  51. data/spec/plugin/head_spec.rb +10 -10
  52. data/spec/plugin/header_matchers_spec.rb +13 -13
  53. data/spec/plugin/heartbeat_spec.rb +74 -0
  54. data/spec/plugin/hooks_spec.rb +20 -20
  55. data/spec/plugin/indifferent_params_spec.rb +1 -1
  56. data/spec/plugin/json_parser_spec.rb +72 -0
  57. data/spec/plugin/json_spec.rb +22 -9
  58. data/spec/plugin/mailer_spec.rb +72 -58
  59. data/spec/plugin/match_affix_spec.rb +2 -2
  60. data/spec/plugin/middleware_spec.rb +7 -7
  61. data/spec/plugin/module_include_spec.rb +4 -4
  62. data/spec/plugin/multi_route_spec.rb +66 -66
  63. data/spec/plugin/multi_run_spec.rb +21 -21
  64. data/spec/plugin/named_templates_spec.rb +6 -6
  65. data/spec/plugin/not_allowed_spec.rb +17 -17
  66. data/spec/plugin/not_found_spec.rb +14 -14
  67. data/spec/plugin/padrino_render_spec.rb +2 -2
  68. data/spec/plugin/param_matchers_spec.rb +6 -6
  69. data/spec/plugin/partials_spec.rb +3 -3
  70. data/spec/plugin/pass_spec.rb +7 -7
  71. data/spec/plugin/path_matchers_spec.rb +6 -6
  72. data/spec/plugin/path_rewriter_spec.rb +37 -0
  73. data/spec/plugin/path_spec.rb +41 -40
  74. data/spec/plugin/per_thread_caching_spec.rb +6 -6
  75. data/spec/plugin/precompile_templates_spec.rb +74 -0
  76. data/spec/plugin/render_each_spec.rb +4 -4
  77. data/spec/plugin/render_spec.rb +179 -76
  78. data/spec/plugin/shared_vars_spec.rb +4 -4
  79. data/spec/plugin/sinatra_helpers_spec.rb +121 -121
  80. data/spec/plugin/slash_path_empty_spec.rb +10 -10
  81. data/spec/plugin/static_spec.rb +4 -4
  82. data/spec/plugin/streaming_spec.rb +11 -11
  83. data/spec/plugin/symbol_matchers_spec.rb +24 -24
  84. data/spec/plugin/symbol_views_spec.rb +3 -3
  85. data/spec/plugin/view_options_spec.rb +10 -10
  86. data/spec/plugin_spec.rb +2 -2
  87. data/spec/redirect_spec.rb +10 -10
  88. data/spec/request_spec.rb +8 -8
  89. data/spec/response_spec.rb +23 -23
  90. data/spec/session_spec.rb +4 -4
  91. data/spec/spec_helper.rb +5 -19
  92. data/spec/version_spec.rb +4 -4
  93. data/spec/views/iv.erb +1 -0
  94. metadata +16 -5
@@ -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].should == "bar"
7
+ c.opts[:foo].must_equal "bar"
8
8
 
9
9
  sc = Class.new(c)
10
- sc.opts[:foo].should == "bar"
10
+ sc.opts[:foo].must_equal "bar"
11
11
 
12
12
  sc.opts[:foo] = "baz"
13
- sc.opts[:foo].should == "baz"
14
- c.opts[:foo].should == "bar"
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.should == "Hello World"
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].should == "bar"
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].should == "baz"
40
- c.opts[:foo].should == "baz"
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.should == '&lt;&gt; <>'
24
+ body.must_equal '&lt;&gt; <>'
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.should == '&lt;&gt; <>'
39
+ body.must_equal '&lt;&gt; <>'
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 '&lt;&gt; <>'
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.should == "ab''1 ab'1"
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 '&lt;&gt;'
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').should == 'd'
19
- body('REQUEST_METHOD'=>'HEAD').should == 'h'
20
- body('REQUEST_METHOD'=>'OPTIONS').should == 'o'
21
- body('REQUEST_METHOD'=>'PATCH').should == 'pa'
22
- body('REQUEST_METHOD'=>'PUT').should == 'pu'
23
- body('REQUEST_METHOD'=>'TRACE').should == 't'
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').should == 'l'
26
- body('REQUEST_METHOD'=>'UNLINK').should == 'u'
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
@@ -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
- for lib in %w'tilt sass'
6
- require lib
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).should == %w"spec/assets/js/ spec/assets/css/ spec/assets/app spec/assets/app".map{|s| File.join(Dir.pwd, s)}
54
- app.assets_opts.values_at(*rpaths).should == %w"assets/js/ assets/css/ assets/app assets/app"
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).should == %w"bar/j/ bar/c/ foo/as/a foo/as/a".map{|s| File.join(Dir.pwd, s)}
58
- app.assets_opts.values_at(*rpaths).should == %w"as/j/ as/c/ as/a as/a"
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).should == %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).should == %w"as/j/ as/c/ as/a as/a"
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).should == %w"bar/j/ bar/c/ foo/cp/cj/a foo/cp/cs/a".map{|s| File.join(Dir.pwd, s)}
66
- app.assets_opts.values_at(*rpaths).should == %w"as/j/ as/c/ as/cj/a as/cs/a"
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).should == %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).should == %w"as/jr/ as/cr/ as/cjr/a as/ccr/a"
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).should == %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).should == %w"as/j/ as/c/ as/cj/a as/cs/a"
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).should == %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).should == %w"as/j/ as/c/ as/cj/a as/cs/a"
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).should == %w"bar/j/ bar/c/ foo/cp/a foo/cp/a".map{|s| File.join(Dir.pwd, s)}
82
- app.assets_opts.values_at(*rpaths).should == %w"as/j/ as/c/ as/a as/a"
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).should == %w"bar/ bar/ foo/cp/a foo/cp/a".map{|s| File.join(Dir.pwd, s)}
86
- app.assets_opts.values_at(*rpaths).should == %w"as/ as/ as/a as/a"
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).should == %w"bar/ bar/ cp/a cp/a".map{|s| File.join(Dir.pwd, s)}
90
- app.assets_opts.values_at(*rpaths).should == %w"as/ as/ as/a as/a"
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).should == ['', '', 'a', 'a'].map{|s| File.join(Dir.pwd, s)}
94
- app.assets_opts.values_at(*rpaths).should == ['as/', 'as/', 'as/a', 'as/a']
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).should == ['', '', 'a', 'a'].map{|s| File.join(Dir.pwd, s)}
98
- app.assets_opts.values_at(*rpaths).should == ['', '', 'a', 'a']
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).should == ['', ''].map{|s| File.join(Dir.pwd, s)} + ['', ''].map{|s| File.join(Dir.pwd, s).chop}
102
- app.assets_opts.values_at(*rpaths).should == ['', '', '', '']
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).should == [{'Content-Type'=>"text/css; charset=UTF-8"}, {'Content-Type'=>"application/javascript; charset=UTF-8"}, {}]
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).should == [{'Content-Type'=>"text/css; charset=UTF-8", 'A'=>'B'}, {'Content-Type'=>"application/javascript; charset=UTF-8", 'A'=>'B'}, {'a'=>'b'}]
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).should == [{'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
+ 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).should == [{'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
+ 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).should == [{'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'}]
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).should == [{'Content-Type'=>"C", 'A'=>'B', 'C'=>'D', 'E'=>'G'}, {'Content-Type'=>"C", 'A'=>'B', 'E'=>'F'}, {'a'=>'b', 'c'=>'d'}]
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).should == [{'Content-Type'=>"C", 'A'=>'B1', 'C'=>'D', 'E'=>'G'}, {'Content-Type'=>"C", 'A'=>'B', 'E'=>'F1'}, {'a'=>'b', 'c'=>'d1'}]
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.should == 2
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.should == 1
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.should =~ /color: red;/
139
- css2.should =~ /color: blue;/
140
- js.should include('console.log')
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.should == 2
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.should == 1
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.should =~ /color: red;/
156
- css2.should =~ /color: blue;/
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.should == 2
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.should == 1
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.should =~ /color:red\}/
172
- css2.should =~ /color: blue;/
173
- js.should include('console.log')
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.should == 2
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.should == 1
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.should =~ /color: red;/
195
- css2.should =~ /color: blue;/
196
- js.should include('console.log')
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.should == 2
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.should == 1
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.should =~ /color: red;/
218
- css2.should =~ /color: blue;/
219
- js.should include('console.log')
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.should == 1
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.should == 1
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.should =~ /color: ?red/
232
- css.should =~ /color: ?blue/
233
- js.should include('console.log')
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.should == 1
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.should =~ /color: ?red/
247
- css.should =~ /color: ?blue/
248
- js.should include('console.log')
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.should == 1
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.should == 1
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.should =~ /color: ?red/
263
- css.should =~ /color: ?blue/
264
- js.should include('console.log')
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.should == 1
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.should == 1
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.should =~ /color: ?red/
285
- css.should =~ /color: ?blue/
286
- js.should include('console.log')
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.should == 1
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.should == 1
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.should =~ /color: ?red/
308
- css.should =~ /color: ?blue/
309
- js.should include('console.log')
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.should == 1
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.should == 1
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.should =~ /color: ?red/
330
- css.should =~ /color: ?blue/
331
- js.should include('console.log')
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.should == 1
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.should == 1
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.should =~ /color: ?red/
345
- css.should =~ /color: ?blue/
346
- js.should include('console.log')
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.should == 1
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.should == 0
356
- css.should =~ /color: ?red/
357
- css.should =~ /color: ?blue/
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.should == 0
364
- html.scan(/<script/).length.should == 1
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.should include('console.log')
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.should == 0
374
- html.scan(/<script/).length.should == 1
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.should include('console.log')
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.should == 0
385
- html.scan(/<script/).length.should == 1
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.should include('console.log')
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.should == 0
396
- html.scan(/<script/).length.should == 1
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.should include('console.log')
404
+ js.must_include('console.log')
400
405
  end
401
406
 
402
- it '#assets should include attributes given' do
403
- app.allocate.assets([:js, :head], 'a'=>'b').should == '<script type="text/javascript" a="b" src="/assets/js/head/app.js"></script>'
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').should == '<script type="text/javascript" a="b&quot;e" src="/assets/js/head/app.js"></script>'
412
+ app.allocate.assets([:js, :head], 'a'=>'b"e').must_equal '<script type="text/javascript" a="b&quot;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).should == 304
414
- body(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).should == ''
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).should == 200
422
- body(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).should include('console.log')
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).should == 304
430
- body(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).should == ''
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+1, js_mtime+1].max, css_file)
438
- status(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).should == 200
439
- body(loc, 'HTTP_IF_MODIFIED_SINCE'=>lm).should include('console.log')
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').should == 404
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').should == 404
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.should == 1
454
- a.first.length.should == 2
455
- a.first.first.should == 'js'
456
- 'assets/js/head/app.js'.should =~ a.first.last
457
- 'assets/js/head/app2.js'.should_not =~ a.first.last
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.should == []
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).should == false
468
- app.allocate.assets([:js, :head]).should == '<script type="text/javascript" src="/assets/js/head/app.js"></script>'
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).should == true
472
- app.allocate.assets([:js, :head]).should =~ %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
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]).should == '<script type="text/javascript" src="/assets/js/head/app.js"></script>'
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]).should =~ %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
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].should == File.join(Dir.pwd, 'assets')
486
- app.assets_opts[:js_path].should == File.join(Dir.pwd, 'assets/js/')
487
- app.assets_opts[:css_path].should == File.join(Dir.pwd, 'assets/css/')
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].should == '/foo/assets'
492
- app.assets_opts[:js_path].should == '/foo/assets/js/'
493
- app.assets_opts[:css_path].should == '/foo/assets/css/'
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].should == '/foo/bar/assets'
498
- app.assets_opts[:js_path].should == '/foo/bar/assets/js/'
499
- app.assets_opts[:css_path].should == '/foo/bar/assets/css/'
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].should == File.join(Dir.pwd, 'assets')
504
- app.assets_opts[:js_path].should == File.join(Dir.pwd, 'assets/js/')
505
- app.assets_opts[:css_path].should == File.join(Dir.pwd, 'assets/css/')
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