mango 0.5.4 → 0.6.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.
- data/.gitignore +1 -2
- data/.rvmrc +1 -0
- data/.yardopts +1 -3
- data/{CHANGES.mdown → CHANGES.md} +40 -0
- data/Gemfile.lock +35 -23
- data/LICENSE +1 -1
- data/{README.mdown → README.md} +38 -27
- data/Rakefile +0 -13
- data/lib/mango.rb +5 -0
- data/lib/mango/application.rb +361 -129
- data/lib/mango/content_page.rb +89 -115
- data/lib/mango/core_ext/string.rb +16 -0
- data/lib/mango/core_ext/uri.rb +14 -0
- data/lib/mango/dependencies.rb +5 -4
- data/lib/mango/flavored_markdown.rb +7 -0
- data/lib/mango/rack/debugger.rb +20 -0
- data/lib/mango/runner.rb +33 -50
- data/lib/mango/templates/.gitignore +0 -1
- data/lib/mango/templates/Gemfile +1 -1
- data/lib/mango/templates/content/index.erb +6 -0
- data/lib/mango/templates/themes/default/javascripts/timer.coffee +6 -0
- data/lib/mango/templates/themes/default/public/javascripts/fireworks.js +0 -0
- data/lib/mango/templates/themes/default/public/{styles → stylesheets}/fireworks.css +0 -0
- data/lib/mango/templates/themes/default/public/{styles → stylesheets}/reset.css +0 -2
- data/lib/mango/templates/themes/default/{styles → stylesheets}/screen.sass +0 -2
- data/lib/mango/templates/themes/default/views/layout.haml +5 -5
- data/lib/mango/templates/themes/default/views/page.haml +1 -3
- data/lib/mango/version.rb +1 -1
- data/mango.gemspec +12 -10
- data/spec/fixture/content/engines/erb.erb +7 -0
- data/spec/fixture/content/engines/haml.haml +4 -4
- data/spec/fixture/content/engines/liquid.liquid +7 -0
- data/spec/fixture/content/engines/markdown.markdown +0 -6
- data/spec/fixture/content/engines/md.md +0 -6
- data/spec/fixture/content/engines/mkd.mkd +1 -0
- data/spec/fixture/content/page_with_missing_view.haml +2 -2
- data/spec/fixture/content/page_with_unregistered_view.haml +4 -0
- data/spec/fixture/content/view_engines/erb.haml +4 -0
- data/spec/fixture/content/view_engines/liquid.haml +4 -0
- data/spec/fixture/themes/default/javascripts/override.coffee +1 -0
- data/spec/fixture/themes/default/javascripts/siblings.coffee +7 -0
- data/spec/fixture/themes/default/javascripts/songs/happy.coffee +5 -0
- data/spec/fixture/themes/default/public/404.html +11 -0
- data/spec/fixture/themes/default/public/javascripts/econ.js +8 -0
- data/spec/fixture/themes/default/public/javascripts/math/opposite.js +6 -0
- data/spec/fixture/themes/default/public/javascripts/override.js +1 -0
- data/spec/fixture/themes/default/public/root.js +5 -0
- data/spec/fixture/themes/default/public/{styles → stylesheets}/override.css +0 -0
- data/spec/fixture/themes/default/public/{styles → stylesheets}/reset.css +0 -0
- data/spec/fixture/themes/default/public/{styles → stylesheets}/subfolder/another.css +0 -0
- data/spec/fixture/themes/default/security_hole.js +1 -0
- data/spec/fixture/themes/default/{styles → stylesheets}/override.sass +0 -0
- data/spec/fixture/themes/default/{styles/screen.sass → stylesheets/sass.sass} +4 -2
- data/spec/fixture/themes/default/stylesheets/scss.scss +19 -0
- data/spec/fixture/themes/default/{styles → stylesheets}/subfolder/screen.sass +0 -2
- data/spec/fixture/themes/default/views/404.erb +11 -0
- data/spec/fixture/themes/default/views/404.haml +1 -0
- data/spec/fixture/themes/default/views/404.liquid +11 -0
- data/spec/fixture/themes/default/views/layout.erb +10 -0
- data/spec/fixture/themes/default/views/layout.haml +1 -1
- data/spec/fixture/themes/default/views/layout.liquid +10 -0
- data/spec/fixture/themes/default/views/page.erb +7 -0
- data/spec/fixture/themes/default/views/page.haml +3 -1
- data/spec/fixture/themes/default/views/page.liquid +7 -0
- data/spec/lib/application/routing_content_pages_spec.rb +298 -21
- data/spec/lib/application/routing_javascript_templates_spec.rb +278 -0
- data/spec/lib/application/routing_not_found_spec.rb +254 -0
- data/spec/lib/application/routing_public_files_spec.rb +9 -8
- data/spec/lib/application/{routing_style_sheets_spec.rb → routing_stylesheet_templates_spec.rb} +61 -24
- data/spec/lib/application_spec.rb +31 -2
- data/spec/lib/content_page/initializing_spec.rb +399 -126
- data/spec/lib/content_page_spec.rb +23 -19
- data/spec/lib/core_ext/string_spec.rb +12 -0
- data/spec/lib/core_ext/uri_spec.rb +42 -0
- data/spec/lib/dependencies_spec.rb +0 -1
- data/spec/lib/flavored_markdown_spec.rb +18 -3
- data/spec/lib/runner_spec.rb +40 -39
- data/spec/lib/version_spec.rb +4 -4
- metadata +145 -64
- data/lib/mango/templates/content/index.md +0 -5
- data/lib/mango/templates/themes/default/public/javascripts/timer.js +0 -5
- data/spec/fixture/content/engines/mdown.mdown +0 -7
- data/spec/lib/content_page/finding_spec.rb +0 -213
data/lib/mango/templates/Gemfile
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
%html
|
|
3
3
|
%head
|
|
4
4
|
%meta{ :charset => "utf-8" }
|
|
5
|
-
%title= "Mango: #{
|
|
5
|
+
%title= "Mango: #{page.title}"
|
|
6
6
|
%link{ :rel => "stylesheet", :type => "text/css", :media => "screen", :href => "http://fonts.googleapis.com/css?family=Lobster" }
|
|
7
|
-
%link{ :rel => "stylesheet", :type => "text/css", :media => "screen", :href => "/
|
|
8
|
-
%link{ :rel => "stylesheet", :type => "text/css", :media => "screen", :href => "/
|
|
9
|
-
%link{ :rel => "stylesheet", :type => "text/css", :media => "screen", :href => "/
|
|
7
|
+
%link{ :rel => "stylesheet", :type => "text/css", :media => "screen", :href => "/stylesheets/reset.css" }
|
|
8
|
+
%link{ :rel => "stylesheet", :type => "text/css", :media => "screen", :href => "/stylesheets/screen.css" }
|
|
9
|
+
%link{ :rel => "stylesheet", :type => "text/css", :media => "screen", :href => "/stylesheets/fireworks.css" }
|
|
10
10
|
%script{ :type => "text/javascript", :src => "/javascripts/fireworks.js"}
|
|
11
11
|
%script{ :type => "text/javascript", :src => "/javascripts/timer.js"}
|
|
12
|
-
%body
|
|
12
|
+
%body
|
|
13
13
|
%div#fireworks-template
|
|
14
14
|
%div#fw.firework
|
|
15
15
|
%div#fp.fireworkParticle
|
data/lib/mango/version.rb
CHANGED
data/mango.gemspec
CHANGED
|
@@ -15,18 +15,20 @@ Gem::Specification.new do |s|
|
|
|
15
15
|
s.required_rubygems_version = ">= 1.3.7"
|
|
16
16
|
s.rubyforge_project = "mango"
|
|
17
17
|
|
|
18
|
-
s.add_runtime_dependency "bundler",
|
|
19
|
-
s.add_runtime_dependency "rack",
|
|
20
|
-
s.add_runtime_dependency "sinatra",
|
|
21
|
-
s.add_runtime_dependency "haml",
|
|
22
|
-
s.add_runtime_dependency "
|
|
23
|
-
s.add_runtime_dependency "
|
|
18
|
+
s.add_runtime_dependency "bundler", "~> 1.0.7"
|
|
19
|
+
s.add_runtime_dependency "rack", "~> 1.2.2"
|
|
20
|
+
s.add_runtime_dependency "sinatra", "~> 1.2.6"
|
|
21
|
+
s.add_runtime_dependency "haml", "~> 3.1.1"
|
|
22
|
+
s.add_runtime_dependency "sass", "~> 3.1.1"
|
|
23
|
+
s.add_runtime_dependency "liquid", "~> 2.2.2"
|
|
24
|
+
s.add_runtime_dependency "bluecloth", "~> 2.1.0"
|
|
25
|
+
s.add_runtime_dependency "coffee-script", "~> 2.2.0"
|
|
26
|
+
s.add_runtime_dependency "thor", "~> 0.14.6"
|
|
24
27
|
|
|
25
|
-
s.add_development_dependency "rspec", "~> 2.
|
|
26
|
-
s.add_development_dependency "rack-test", "~> 0.
|
|
27
|
-
s.add_development_dependency "yard", "~> 0.
|
|
28
|
+
s.add_development_dependency "rspec", "~> 2.6.0"
|
|
29
|
+
s.add_development_dependency "rack-test", "~> 0.6.0"
|
|
30
|
+
s.add_development_dependency "yard", "~> 0.7.1"
|
|
28
31
|
s.add_development_dependency "bluecloth", "~> 2.1.0"
|
|
29
|
-
s.add_development_dependency "yard-sinatra", "~> 0.5.1"
|
|
30
32
|
|
|
31
33
|
s.files = `git ls-files`.split("\n")
|
|
32
34
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
### /engines/mkd.mkd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
singers = {Jagger: "Rock", Elvis: "Roll"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var bitlist = [1, 0, 1, 0, 0, 1, 1, 1, 0];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This file should *not* be accessible to a browser.
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
$blue: #3bbfce;
|
|
2
|
+
$margin: 16px;
|
|
3
|
+
$template: "scss.scss";
|
|
4
|
+
|
|
5
|
+
.main {
|
|
6
|
+
background-image: url($template);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.content-navigation {
|
|
10
|
+
border-color: $blue;
|
|
11
|
+
color:
|
|
12
|
+
darken($blue, 9%);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.border {
|
|
16
|
+
padding: $margin / 2;
|
|
17
|
+
margin: $margin / 2;
|
|
18
|
+
border-color: $blue;
|
|
19
|
+
}
|
|
@@ -12,7 +12,7 @@ describe Mango::Application do
|
|
|
12
12
|
#################################################################################################
|
|
13
13
|
|
|
14
14
|
describe "GET (empty String)" do
|
|
15
|
-
before(:
|
|
15
|
+
before(:all) do
|
|
16
16
|
get ""
|
|
17
17
|
end
|
|
18
18
|
|
|
@@ -30,10 +30,11 @@ describe Mango::Application do
|
|
|
30
30
|
<html>
|
|
31
31
|
<head>
|
|
32
32
|
<meta charset='utf-8' />
|
|
33
|
-
<title>
|
|
33
|
+
<title>layout.haml</title>
|
|
34
34
|
</head>
|
|
35
35
|
<body>
|
|
36
36
|
<h1>Welcome to Mango!</h1>
|
|
37
|
+
<p id='template'>page.haml</p>
|
|
37
38
|
<div id='content'>
|
|
38
39
|
<p>/index.haml</p>
|
|
39
40
|
</div>
|
|
@@ -46,7 +47,7 @@ describe Mango::Application do
|
|
|
46
47
|
#################################################################################################
|
|
47
48
|
|
|
48
49
|
describe "GET /" do
|
|
49
|
-
before(:
|
|
50
|
+
before(:all) do
|
|
50
51
|
get "/"
|
|
51
52
|
end
|
|
52
53
|
|
|
@@ -64,10 +65,11 @@ describe Mango::Application do
|
|
|
64
65
|
<html>
|
|
65
66
|
<head>
|
|
66
67
|
<meta charset='utf-8' />
|
|
67
|
-
<title>
|
|
68
|
+
<title>layout.haml</title>
|
|
68
69
|
</head>
|
|
69
70
|
<body>
|
|
70
71
|
<h1>Welcome to Mango!</h1>
|
|
72
|
+
<p id='template'>page.haml</p>
|
|
71
73
|
<div id='content'>
|
|
72
74
|
<p>/index.haml</p>
|
|
73
75
|
</div>
|
|
@@ -80,7 +82,7 @@ describe Mango::Application do
|
|
|
80
82
|
#################################################################################################
|
|
81
83
|
|
|
82
84
|
describe "GET /index" do
|
|
83
|
-
before(:
|
|
85
|
+
before(:all) do
|
|
84
86
|
get "/index"
|
|
85
87
|
end
|
|
86
88
|
|
|
@@ -98,10 +100,11 @@ describe Mango::Application do
|
|
|
98
100
|
<html>
|
|
99
101
|
<head>
|
|
100
102
|
<meta charset='utf-8' />
|
|
101
|
-
<title>
|
|
103
|
+
<title>layout.haml</title>
|
|
102
104
|
</head>
|
|
103
105
|
<body>
|
|
104
106
|
<h1>Welcome to Mango!</h1>
|
|
107
|
+
<p id='template'>page.haml</p>
|
|
105
108
|
<div id='content'>
|
|
106
109
|
<p>/index.haml</p>
|
|
107
110
|
</div>
|
|
@@ -114,7 +117,7 @@ describe Mango::Application do
|
|
|
114
117
|
#################################################################################################
|
|
115
118
|
|
|
116
119
|
describe "GET /index?foo=bar" do
|
|
117
|
-
before(:
|
|
120
|
+
before(:all) do
|
|
118
121
|
get "/index?foo=bar"
|
|
119
122
|
end
|
|
120
123
|
|
|
@@ -132,10 +135,11 @@ describe Mango::Application do
|
|
|
132
135
|
<html>
|
|
133
136
|
<head>
|
|
134
137
|
<meta charset='utf-8' />
|
|
135
|
-
<title>
|
|
138
|
+
<title>layout.haml</title>
|
|
136
139
|
</head>
|
|
137
140
|
<body>
|
|
138
141
|
<h1>Welcome to Mango!</h1>
|
|
142
|
+
<p id='template'>page.haml</p>
|
|
139
143
|
<div id='content'>
|
|
140
144
|
<p>/index.haml</p>
|
|
141
145
|
</div>
|
|
@@ -148,7 +152,7 @@ describe Mango::Application do
|
|
|
148
152
|
#################################################################################################
|
|
149
153
|
|
|
150
154
|
describe "GET /about/" do
|
|
151
|
-
before(:
|
|
155
|
+
before(:all) do
|
|
152
156
|
get "/about/"
|
|
153
157
|
end
|
|
154
158
|
|
|
@@ -166,10 +170,11 @@ describe Mango::Application do
|
|
|
166
170
|
<html>
|
|
167
171
|
<head>
|
|
168
172
|
<meta charset='utf-8' />
|
|
169
|
-
<title>
|
|
173
|
+
<title>layout.haml</title>
|
|
170
174
|
</head>
|
|
171
175
|
<body>
|
|
172
176
|
<h1>Welcome to Mango!</h1>
|
|
177
|
+
<p id='template'>page.haml</p>
|
|
173
178
|
<div id='content'>
|
|
174
179
|
<p>/about/index.haml</p>
|
|
175
180
|
</div>
|
|
@@ -182,7 +187,7 @@ describe Mango::Application do
|
|
|
182
187
|
#################################################################################################
|
|
183
188
|
|
|
184
189
|
describe "GET /about/index" do
|
|
185
|
-
before(:
|
|
190
|
+
before(:all) do
|
|
186
191
|
get "/about/index"
|
|
187
192
|
end
|
|
188
193
|
|
|
@@ -200,10 +205,11 @@ describe Mango::Application do
|
|
|
200
205
|
<html>
|
|
201
206
|
<head>
|
|
202
207
|
<meta charset='utf-8' />
|
|
203
|
-
<title>
|
|
208
|
+
<title>layout.haml</title>
|
|
204
209
|
</head>
|
|
205
210
|
<body>
|
|
206
211
|
<h1>Welcome to Mango!</h1>
|
|
212
|
+
<p id='template'>page.haml</p>
|
|
207
213
|
<div id='content'>
|
|
208
214
|
<p>/about/index.haml</p>
|
|
209
215
|
</div>
|
|
@@ -216,7 +222,7 @@ describe Mango::Application do
|
|
|
216
222
|
#################################################################################################
|
|
217
223
|
|
|
218
224
|
describe "GET /about/us" do
|
|
219
|
-
before(:
|
|
225
|
+
before(:all) do
|
|
220
226
|
get "/about/us"
|
|
221
227
|
end
|
|
222
228
|
|
|
@@ -234,10 +240,11 @@ describe Mango::Application do
|
|
|
234
240
|
<html>
|
|
235
241
|
<head>
|
|
236
242
|
<meta charset='utf-8' />
|
|
237
|
-
<title>
|
|
243
|
+
<title>layout.haml</title>
|
|
238
244
|
</head>
|
|
239
245
|
<body>
|
|
240
246
|
<h1>Welcome to Mango!</h1>
|
|
247
|
+
<p id='template'>page.haml</p>
|
|
241
248
|
<div id='content'>
|
|
242
249
|
<p>/about/us.haml</p>
|
|
243
250
|
</div>
|
|
@@ -250,7 +257,7 @@ describe Mango::Application do
|
|
|
250
257
|
#################################################################################################
|
|
251
258
|
|
|
252
259
|
describe "GET /turner%2Bhooch" do
|
|
253
|
-
before(:
|
|
260
|
+
before(:all) do
|
|
254
261
|
get "/turner%2Bhooch"
|
|
255
262
|
end
|
|
256
263
|
|
|
@@ -268,10 +275,11 @@ describe Mango::Application do
|
|
|
268
275
|
<html>
|
|
269
276
|
<head>
|
|
270
277
|
<meta charset='utf-8' />
|
|
271
|
-
<title>
|
|
278
|
+
<title>layout.haml</title>
|
|
272
279
|
</head>
|
|
273
280
|
<body>
|
|
274
281
|
<h1>Welcome to Mango!</h1>
|
|
282
|
+
<p id='template'>page.haml</p>
|
|
275
283
|
<div id='content'>
|
|
276
284
|
<p>/turner+hooch.haml</p>
|
|
277
285
|
</div>
|
|
@@ -283,8 +291,85 @@ describe Mango::Application do
|
|
|
283
291
|
|
|
284
292
|
#################################################################################################
|
|
285
293
|
|
|
294
|
+
describe "GET /view_engines/erb" do
|
|
295
|
+
before(:all) do
|
|
296
|
+
get "/view_engines/erb"
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
it "returns 200 status code" do
|
|
300
|
+
last_response.should be_ok
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
it "sends the correct Content-Type header" do
|
|
304
|
+
last_response["Content-Type"].should == "text/html;charset=utf-8"
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
it "sends the correct body content" do
|
|
308
|
+
last_response.body.should == <<-EXPECTED
|
|
309
|
+
<!DOCTYPE html>
|
|
310
|
+
<html>
|
|
311
|
+
<head>
|
|
312
|
+
<meta charset='utf-8' />
|
|
313
|
+
<title>layout.erb</title>
|
|
314
|
+
</head>
|
|
315
|
+
<body>
|
|
316
|
+
<h1>Welcome to Mango!</h1>
|
|
317
|
+
|
|
318
|
+
<p id="template">page.erb</p>
|
|
319
|
+
|
|
320
|
+
<div id="content">
|
|
321
|
+
<p>/view_engines/erb.haml</p>
|
|
322
|
+
|
|
323
|
+
</div>
|
|
324
|
+
</body>
|
|
325
|
+
</html>
|
|
326
|
+
EXPECTED
|
|
327
|
+
end
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
#################################################################################################
|
|
331
|
+
|
|
332
|
+
describe "GET /view_engines/liquid" do
|
|
333
|
+
before(:all) do
|
|
334
|
+
get "/view_engines/liquid"
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
it "returns 200 status code" do
|
|
338
|
+
last_response.should be_ok
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
it "sends the correct Content-Type header" do
|
|
342
|
+
last_response["Content-Type"].should == "text/html;charset=utf-8"
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
it "sends the correct body content" do
|
|
346
|
+
last_response.body.should == <<-EXPECTED
|
|
347
|
+
<!DOCTYPE html>
|
|
348
|
+
<html>
|
|
349
|
+
<head>
|
|
350
|
+
<meta charset='utf-8' />
|
|
351
|
+
<title>layout.liquid</title>
|
|
352
|
+
</head>
|
|
353
|
+
<body>
|
|
354
|
+
<h1>Welcome to Mango!</h1>
|
|
355
|
+
|
|
356
|
+
<p id="template">page.liquid</p>
|
|
357
|
+
|
|
358
|
+
<div id="content">
|
|
359
|
+
<p>/view_engines/liquid.haml</p>
|
|
360
|
+
|
|
361
|
+
</div>
|
|
362
|
+
|
|
363
|
+
</body>
|
|
364
|
+
</html>
|
|
365
|
+
EXPECTED
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
#################################################################################################
|
|
370
|
+
|
|
286
371
|
describe "GET /page_not_found" do
|
|
287
|
-
before(:
|
|
372
|
+
before(:all) do
|
|
288
373
|
get "/page_not_found"
|
|
289
374
|
end
|
|
290
375
|
|
|
@@ -306,6 +391,7 @@ describe Mango::Application do
|
|
|
306
391
|
</head>
|
|
307
392
|
<body>
|
|
308
393
|
<h1>Page not found</h1>
|
|
394
|
+
<p id='template'>404.html</p>
|
|
309
395
|
</body>
|
|
310
396
|
</html>
|
|
311
397
|
EXPECTED
|
|
@@ -314,19 +400,32 @@ describe Mango::Application do
|
|
|
314
400
|
|
|
315
401
|
#################################################################################################
|
|
316
402
|
|
|
403
|
+
describe "GET /page_with_unregistered_view" do
|
|
404
|
+
it "raises an exception" do
|
|
405
|
+
path = FIXTURE_ROOT + "themes/default/views/unregistered.extension"
|
|
406
|
+
message = "Cannot find registered engine for view template file -- #{path}"
|
|
407
|
+
lambda {
|
|
408
|
+
get "/page_with_unregistered_view"
|
|
409
|
+
}.should raise_exception(Mango::Application::RegisteredEngineNotFound, message)
|
|
410
|
+
end
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
#################################################################################################
|
|
414
|
+
|
|
317
415
|
describe "GET /page_with_missing_view" do
|
|
318
|
-
it "raises
|
|
319
|
-
path
|
|
416
|
+
it "raises an exception" do
|
|
417
|
+
path = FIXTURE_ROOT + "themes/default/views/missing.haml"
|
|
418
|
+
message = "Cannot find view template file -- #{path}"
|
|
320
419
|
lambda {
|
|
321
420
|
get "/page_with_missing_view"
|
|
322
|
-
}.should raise_exception(
|
|
421
|
+
}.should raise_exception(Mango::Application::ViewTemplateNotFound, message)
|
|
323
422
|
end
|
|
324
423
|
end
|
|
325
424
|
|
|
326
425
|
#################################################################################################
|
|
327
426
|
|
|
328
427
|
describe "GET /../security_hole" do
|
|
329
|
-
before(:
|
|
428
|
+
before(:all) do
|
|
330
429
|
get "/../security_hole"
|
|
331
430
|
end
|
|
332
431
|
|
|
@@ -348,10 +447,188 @@ describe Mango::Application do
|
|
|
348
447
|
</head>
|
|
349
448
|
<body>
|
|
350
449
|
<h1>Page not found</h1>
|
|
450
|
+
<p id='template'>404.html</p>
|
|
451
|
+
</body>
|
|
452
|
+
</html>
|
|
453
|
+
EXPECTED
|
|
454
|
+
end
|
|
455
|
+
end
|
|
456
|
+
|
|
457
|
+
#################################################################################################
|
|
458
|
+
|
|
459
|
+
describe "GET /engines/haml" do
|
|
460
|
+
before(:all) do
|
|
461
|
+
get "/engines/haml"
|
|
462
|
+
end
|
|
463
|
+
|
|
464
|
+
it "returns 200 status code" do
|
|
465
|
+
last_response.should be_ok
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
it "sends the correct Content-Type header" do
|
|
469
|
+
last_response["Content-Type"].should == "text/html;charset=utf-8"
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
it "sends the correct body content" do
|
|
473
|
+
last_response.body.should == <<-EXPECTED
|
|
474
|
+
<!DOCTYPE html>
|
|
475
|
+
<html>
|
|
476
|
+
<head>
|
|
477
|
+
<meta charset='utf-8' />
|
|
478
|
+
<title>layout.haml</title>
|
|
479
|
+
</head>
|
|
480
|
+
<body>
|
|
481
|
+
<h1>Welcome to Mango!</h1>
|
|
482
|
+
<p id='template'>page.haml</p>
|
|
483
|
+
<div id='content'>
|
|
484
|
+
<p>engines haml</p>
|
|
485
|
+
<p>/engines/haml.haml</p>
|
|
486
|
+
</div>
|
|
351
487
|
</body>
|
|
352
488
|
</html>
|
|
353
489
|
EXPECTED
|
|
354
490
|
end
|
|
355
491
|
end
|
|
356
492
|
|
|
493
|
+
#################################################################################################
|
|
494
|
+
|
|
495
|
+
describe "GET /engines/md" do
|
|
496
|
+
before(:all) do
|
|
497
|
+
get "/engines/md"
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
it "returns 200 status code" do
|
|
501
|
+
last_response.should be_ok
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
it "sends the correct Content-Type header" do
|
|
505
|
+
last_response["Content-Type"].should == "text/html;charset=utf-8"
|
|
506
|
+
end
|
|
507
|
+
|
|
508
|
+
it "sends the correct body content" do
|
|
509
|
+
last_response.body.should == <<-EXPECTED
|
|
510
|
+
<!DOCTYPE html>
|
|
511
|
+
<html>
|
|
512
|
+
<head>
|
|
513
|
+
<meta charset='utf-8' />
|
|
514
|
+
<title>layout.haml</title>
|
|
515
|
+
</head>
|
|
516
|
+
<body>
|
|
517
|
+
<h1>Welcome to Mango!</h1>
|
|
518
|
+
<p id='template'>page.haml</p>
|
|
519
|
+
<div id='content'>
|
|
520
|
+
<h3>/engines/md.md</h3>
|
|
521
|
+
</div>
|
|
522
|
+
</body>
|
|
523
|
+
</html>
|
|
524
|
+
EXPECTED
|
|
525
|
+
end
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
#################################################################################################
|
|
529
|
+
|
|
530
|
+
describe "GET /engines/mkd" do
|
|
531
|
+
before(:all) do
|
|
532
|
+
get "/engines/mkd"
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
it "returns 200 status code" do
|
|
536
|
+
last_response.should be_ok
|
|
537
|
+
end
|
|
538
|
+
|
|
539
|
+
it "sends the correct Content-Type header" do
|
|
540
|
+
last_response["Content-Type"].should == "text/html;charset=utf-8"
|
|
541
|
+
end
|
|
542
|
+
|
|
543
|
+
it "sends the correct body content" do
|
|
544
|
+
last_response.body.should == <<-EXPECTED
|
|
545
|
+
<!DOCTYPE html>
|
|
546
|
+
<html>
|
|
547
|
+
<head>
|
|
548
|
+
<meta charset='utf-8' />
|
|
549
|
+
<title>layout.haml</title>
|
|
550
|
+
</head>
|
|
551
|
+
<body>
|
|
552
|
+
<h1>Welcome to Mango!</h1>
|
|
553
|
+
<p id='template'>page.haml</p>
|
|
554
|
+
<div id='content'>
|
|
555
|
+
<h3>/engines/mkd.mkd</h3>
|
|
556
|
+
</div>
|
|
557
|
+
</body>
|
|
558
|
+
</html>
|
|
559
|
+
EXPECTED
|
|
560
|
+
end
|
|
561
|
+
end
|
|
562
|
+
|
|
563
|
+
#################################################################################################
|
|
564
|
+
|
|
565
|
+
describe "GET /engines/erb" do
|
|
566
|
+
before(:all) do
|
|
567
|
+
get "/engines/erb"
|
|
568
|
+
end
|
|
569
|
+
|
|
570
|
+
it "returns 200 status code" do
|
|
571
|
+
last_response.should be_ok
|
|
572
|
+
end
|
|
573
|
+
|
|
574
|
+
it "sends the correct Content-Type header" do
|
|
575
|
+
last_response["Content-Type"].should == "text/html;charset=utf-8"
|
|
576
|
+
end
|
|
577
|
+
|
|
578
|
+
it "sends the correct body content" do
|
|
579
|
+
last_response.body.should == <<-EXPECTED
|
|
580
|
+
<!DOCTYPE html>
|
|
581
|
+
<html>
|
|
582
|
+
<head>
|
|
583
|
+
<meta charset='utf-8' />
|
|
584
|
+
<title>layout.haml</title>
|
|
585
|
+
</head>
|
|
586
|
+
<body>
|
|
587
|
+
<h1>Welcome to Mango!</h1>
|
|
588
|
+
<p id='template'>page.haml</p>
|
|
589
|
+
<div id='content'>
|
|
590
|
+
<p>engines erb</p>
|
|
591
|
+
<p>/engines/erb.erb</p>
|
|
592
|
+
</div>
|
|
593
|
+
</body>
|
|
594
|
+
</html>
|
|
595
|
+
EXPECTED
|
|
596
|
+
end
|
|
597
|
+
end
|
|
598
|
+
|
|
599
|
+
#################################################################################################
|
|
600
|
+
|
|
601
|
+
describe "GET /engines/liquid" do
|
|
602
|
+
before(:all) do
|
|
603
|
+
get "/engines/liquid"
|
|
604
|
+
end
|
|
605
|
+
|
|
606
|
+
it "returns 200 status code" do
|
|
607
|
+
last_response.should be_ok
|
|
608
|
+
end
|
|
609
|
+
|
|
610
|
+
it "sends the correct Content-Type header" do
|
|
611
|
+
last_response["Content-Type"].should == "text/html;charset=utf-8"
|
|
612
|
+
end
|
|
613
|
+
|
|
614
|
+
it "sends the correct body content" do
|
|
615
|
+
last_response.body.should == <<-EXPECTED
|
|
616
|
+
<!DOCTYPE html>
|
|
617
|
+
<html>
|
|
618
|
+
<head>
|
|
619
|
+
<meta charset='utf-8' />
|
|
620
|
+
<title>layout.haml</title>
|
|
621
|
+
</head>
|
|
622
|
+
<body>
|
|
623
|
+
<h1>Welcome to Mango!</h1>
|
|
624
|
+
<p id='template'>page.haml</p>
|
|
625
|
+
<div id='content'>
|
|
626
|
+
<p>engines liquid</p>
|
|
627
|
+
<p>/engines/liquid.liquid</p>
|
|
628
|
+
</div>
|
|
629
|
+
</body>
|
|
630
|
+
</html>
|
|
631
|
+
EXPECTED
|
|
632
|
+
end
|
|
633
|
+
end
|
|
357
634
|
end
|