mango 0.5.0.beta5 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGES.mdown +6 -5
  3. data/Gemfile +15 -0
  4. data/Gemfile.lock +41 -0
  5. data/README.mdown +195 -82
  6. data/lib/mango/application.rb +4 -0
  7. data/lib/mango/content_page.rb +1 -1
  8. data/lib/mango/dependencies.rb +2 -2
  9. data/lib/mango/runner.rb +26 -19
  10. data/lib/mango/templates/Gemfile +1 -2
  11. data/lib/mango/templates/README.md +22 -1
  12. data/lib/mango/templates/content/index.md +1 -1
  13. data/lib/mango/templates/themes/default/public/styles/reset.css +1 -1
  14. data/lib/mango/version.rb +1 -1
  15. data/mango.gemspec +4 -4
  16. data/spec/bin/mango_spec.rb +10 -0
  17. data/spec/{app_root → fixture}/content/about/index.haml +0 -0
  18. data/spec/{app_root → fixture}/content/about/us.haml +0 -0
  19. data/spec/{app_root → fixture}/content/engines/haml.haml +0 -0
  20. data/spec/{app_root → fixture}/content/engines/markdown.markdown +0 -0
  21. data/spec/{app_root → fixture}/content/engines/md.md +0 -0
  22. data/spec/{app_root → fixture}/content/engines/mdown.mdown +0 -0
  23. data/spec/{app_root → fixture}/content/index.haml +0 -0
  24. data/spec/{app_root → fixture}/content/override.haml +0 -0
  25. data/spec/{app_root → fixture}/content/page_with_missing_view.haml +0 -0
  26. data/spec/{app_root → fixture}/content/turner+hooch.haml +0 -0
  27. data/spec/{app_root → fixture}/security_hole.haml +0 -0
  28. data/spec/{app_root → fixture}/themes/default/public/default.css +0 -0
  29. data/spec/{app_root → fixture}/themes/default/public/images/index.html +0 -0
  30. data/spec/{app_root → fixture}/themes/default/public/images/ripe-mango.jpg +0 -0
  31. data/spec/{app_root → fixture}/themes/default/public/override +0 -0
  32. data/spec/{app_root → fixture}/themes/default/public/robots.txt +0 -0
  33. data/spec/{app_root → fixture}/themes/default/public/styles/override.css +0 -0
  34. data/spec/{app_root → fixture}/themes/default/public/styles/reset.css +0 -0
  35. data/spec/{app_root → fixture}/themes/default/public/styles/subfolder/another.css +0 -0
  36. data/spec/{app_root → fixture}/themes/default/security_hole.sass +0 -0
  37. data/spec/{app_root → fixture}/themes/default/security_hole.txt +0 -0
  38. data/spec/{app_root → fixture}/themes/default/styles/override.sass +0 -0
  39. data/spec/{app_root → fixture}/themes/default/styles/screen.sass +0 -0
  40. data/spec/{app_root → fixture}/themes/default/styles/subfolder/screen.sass +0 -0
  41. data/spec/{app_root → fixture}/themes/default/views/404.haml +0 -0
  42. data/spec/{app_root → fixture}/themes/default/views/layout.haml +0 -0
  43. data/spec/{app_root → fixture}/themes/default/views/page.haml +0 -0
  44. data/spec/{mango → lib}/application/routing_content_pages_spec.rb +11 -11
  45. data/spec/{mango → lib}/application/routing_public_files_spec.rb +7 -7
  46. data/spec/{mango → lib}/application/routing_style_sheets_spec.rb +9 -9
  47. data/spec/{mango → lib}/application_spec.rb +5 -9
  48. data/spec/{mango → lib}/content_page/finding_spec.rb +5 -5
  49. data/spec/{mango → lib}/content_page/initializing_spec.rb +0 -0
  50. data/spec/{mango → lib}/content_page_spec.rb +0 -0
  51. data/spec/{mango → lib}/dependencies_spec.rb +9 -9
  52. data/spec/{mango → lib}/flavored_markdown_spec.rb +0 -0
  53. data/spec/{mango → lib}/rack/debugger_spec.rb +0 -0
  54. data/spec/lib/runner_spec.rb +380 -0
  55. data/spec/{mango → lib}/version_spec.rb +2 -2
  56. data/spec/quality_spec.rb +2 -2
  57. data/spec/spec_helper.rb +5 -4
  58. metadata +93 -102
@@ -21,7 +21,7 @@ describe Mango::Application do
21
21
  end
22
22
 
23
23
  it "sends the correct Content-Type header" do
24
- last_response["Content-Type"].should == "text/css"
24
+ last_response["Content-Type"].should == "text/css;charset=utf-8"
25
25
  end
26
26
 
27
27
  it "sends the correct body content" do
@@ -51,7 +51,7 @@ describe Mango::Application do
51
51
  end
52
52
 
53
53
  it "sends the correct Content-Type header" do
54
- last_response["Content-Type"].should == "text/css"
54
+ last_response["Content-Type"].should == "text/css;charset=utf-8"
55
55
  end
56
56
 
57
57
  it "sends the correct body content" do
@@ -82,7 +82,7 @@ li {
82
82
  end
83
83
 
84
84
  it "sends the correct Content-Type header" do
85
- last_response["Content-Type"].should == "text/css"
85
+ last_response["Content-Type"].should == "text/css;charset=utf-8"
86
86
  end
87
87
 
88
88
  it "sends the correct body content" do
@@ -130,7 +130,7 @@ time, mark, audio, video {
130
130
  end
131
131
 
132
132
  it "sends the correct Content-Type header" do
133
- last_response["Content-Type"].should == "text/css"
133
+ last_response["Content-Type"].should == "text/css;charset=utf-8"
134
134
  end
135
135
 
136
136
  it "sends the correct body content" do
@@ -154,7 +154,7 @@ time, mark, audio, video {
154
154
  end
155
155
 
156
156
  it "sends the correct Content-Type header" do
157
- last_response["Content-Type"].should == "text/css"
157
+ last_response["Content-Type"].should == "text/css;charset=utf-8"
158
158
  end
159
159
 
160
160
  it "sends the correct body content" do
@@ -178,7 +178,7 @@ time, mark, audio, video {
178
178
  end
179
179
 
180
180
  it "sends the correct Content-Type header" do
181
- last_response["Content-Type"].should == "text/css"
181
+ last_response["Content-Type"].should == "text/css;charset=utf-8"
182
182
  end
183
183
 
184
184
  it "sends the correct body content" do
@@ -202,7 +202,7 @@ time, mark, audio, video {
202
202
  end
203
203
 
204
204
  it "sends the correct Content-Type header" do
205
- last_response["Content-Type"].should == "text/html"
205
+ last_response["Content-Type"].should == "text/html;charset=utf-8"
206
206
  end
207
207
 
208
208
  it "sends the correct body content" do
@@ -233,7 +233,7 @@ time, mark, audio, video {
233
233
  end
234
234
 
235
235
  it "sends the correct Content-Type header" do
236
- last_response["Content-Type"].should == "text/html"
236
+ last_response["Content-Type"].should == "text/html;charset=utf-8"
237
237
  end
238
238
 
239
239
  it "sends the correct body content" do
@@ -264,7 +264,7 @@ time, mark, audio, video {
264
264
  end
265
265
 
266
266
  it "sends the correct Content-Type header" do
267
- last_response["Content-Type"].should == "text/html"
267
+ last_response["Content-Type"].should == "text/html;charset=utf-8"
268
268
  end
269
269
 
270
270
  it "sends the correct body content" do
@@ -3,12 +3,8 @@ require "spec_helper"
3
3
 
4
4
  describe Mango::Application do
5
5
  describe "settings" do
6
- before(:each) do
7
- @expected = SPEC_APP_ROOT
8
- end
9
-
10
6
  it "root should be app_root" do
11
- Mango::Application.root.should == @expected
7
+ Mango::Application.root.should == FIXTURE_ROOT.to_s
12
8
  end
13
9
 
14
10
  it "theme should be default" do
@@ -16,19 +12,19 @@ describe Mango::Application do
16
12
  end
17
13
 
18
14
  it "views should be app_root/themes/default/views/" do
19
- Mango::Application.views.should == File.join(@expected, "themes", "default", "views")
15
+ Mango::Application.views.should == (FIXTURE_ROOT + "themes/default/views").to_s
20
16
  end
21
17
 
22
18
  it "public should be app_root/themes/default/public/" do
23
- Mango::Application.public.should == File.join(@expected, "themes", "default", "public")
19
+ Mango::Application.public.should == (FIXTURE_ROOT + "themes/default/public").to_s
24
20
  end
25
21
 
26
22
  it "styles should be app_root/themes/default/styles/" do
27
- Mango::Application.styles.should == File.join(@expected, "themes", "default", "styles")
23
+ Mango::Application.styles.should == (FIXTURE_ROOT + "themes/default/styles").to_s
28
24
  end
29
25
 
30
26
  it "content should be app_root/content/" do
31
- Mango::Application.content.should == File.join(@expected, "content")
27
+ Mango::Application.content.should == (FIXTURE_ROOT + "content").to_s
32
28
  end
33
29
  end
34
30
  end
@@ -7,7 +7,7 @@ describe Mango::ContentPage do
7
7
 
8
8
  describe "finding app_root/content/engines/haml.haml" do
9
9
  before(:all) do
10
- path = File.join(SPEC_APP_ROOT, "content", "engines", "haml")
10
+ path = FIXTURE_ROOT + "content/engines/haml"
11
11
  @page = Mango::ContentPage.find_by_path(path)
12
12
  end
13
13
 
@@ -55,7 +55,7 @@ category:
55
55
 
56
56
  describe "finding app_root/content/engines/md.md" do
57
57
  before(:all) do
58
- path = File.join(SPEC_APP_ROOT, "content", "engines", "md")
58
+ path = FIXTURE_ROOT + "content/engines/md"
59
59
  @page = Mango::ContentPage.find_by_path(path)
60
60
  end
61
61
 
@@ -103,7 +103,7 @@ category:
103
103
 
104
104
  describe "finding app_root/content/engines/mdown.mdown" do
105
105
  before(:all) do
106
- path = File.join(SPEC_APP_ROOT, "content", "engines", "mdown")
106
+ path = FIXTURE_ROOT + "content/engines/mdown"
107
107
  @page = Mango::ContentPage.find_by_path(path)
108
108
  end
109
109
 
@@ -151,7 +151,7 @@ category:
151
151
 
152
152
  describe "finding app_root/content/engines/markdown.markdown" do
153
153
  before(:all) do
154
- path = File.join(SPEC_APP_ROOT, "content", "engines", "markdown")
154
+ path = FIXTURE_ROOT + "content/engines/markdown"
155
155
  @page = Mango::ContentPage.find_by_path(path)
156
156
  end
157
157
 
@@ -199,7 +199,7 @@ category:
199
199
 
200
200
  describe "finding app_root/content/unknown.anyengine" do
201
201
  before(:all) do
202
- @path = File.join(SPEC_APP_ROOT, "content", "unknown")
202
+ @path = FIXTURE_ROOT + "content/unknown"
203
203
  end
204
204
 
205
205
  it "raises Mango::ContentPage::PageNotFound" do
File without changes
@@ -6,15 +6,15 @@ describe Mango::Dependencies do
6
6
  #################################################################################################
7
7
 
8
8
  describe "class constant and variable defaults" do
9
- it "supports ruby 1.9.1 or 1.9.2" do
10
- Mango::Dependencies::SUPPORTED_RUBY_VERSIONS.should == ["1.9.1", "1.9.2"]
9
+ it "supports ruby 1.9.2" do
10
+ Mango::Dependencies::SUPPORTED_RUBY_VERSIONS.should == ["1.9.2"]
11
11
  end
12
12
 
13
13
  it "development gem names and versions should be correct" do
14
14
  expected = {
15
15
  :"rack-test" => "0.5.6",
16
16
  :rspec => "2.0.1",
17
- :yard => "0.5.8",
17
+ :yard => "0.6.1",
18
18
  :"yard-sinatra" => "0.5.1",
19
19
  :bluecloth => "2.0.9"
20
20
  }
@@ -49,7 +49,7 @@ describe Mango::Dependencies do
49
49
 
50
50
  def expected_message(version)
51
51
  @expected_message = <<-ERROR
52
- This library supports Ruby 1.9.1 or 1.9.2, but you're using #{version}.
52
+ This library supports Ruby 1.9.2, but you're using #{version}.
53
53
  Please visit http://www.ruby-lang.org/ or http://rvm.beginrescueend.com/ for installation instructions.
54
54
  ERROR
55
55
  end
@@ -75,11 +75,11 @@ Please visit http://www.ruby-lang.org/ or http://rvm.beginrescueend.com/ for ins
75
75
  }.should raise_exception(SystemExit, expected_message(version))
76
76
  end
77
77
 
78
- it "doesn't abort for ruby 1.9.1" do
78
+ it "aborts for ruby 1.9.1" do
79
79
  version = "1.9.1"
80
80
  lambda {
81
81
  Mango::Dependencies.send(:check_ruby_version, version)
82
- }.should_not raise_exception(SystemExit, expected_message(version))
82
+ }.should raise_exception(SystemExit, expected_message(version))
83
83
  end
84
84
 
85
85
  it "doesn't abort for ruby 1.9.2" do
@@ -113,7 +113,7 @@ Please visit http://www.ruby-lang.org/ or http://rvm.beginrescueend.com/ for ins
113
113
 
114
114
  it "creates and caches and cache one warning from a known development gem dependency" do
115
115
  Mango::Dependencies.create_warning_for(LoadError.new("no such file to load -- yard"))
116
- Mango::Dependencies.class_variable_get(:@@warnings_cache).should == ["yard --version '0.5.8'"]
116
+ Mango::Dependencies.class_variable_get(:@@warnings_cache).should == ["yard --version '0.6.1'"]
117
117
  end
118
118
 
119
119
  it "creates and caches and cache warnings from all known development gem dependencies" do
@@ -130,7 +130,7 @@ Please visit http://www.ruby-lang.org/ or http://rvm.beginrescueend.com/ for ins
130
130
  expected = [
131
131
  "rack-test --version '0.5.6'",
132
132
  "rspec --version '2.0.1'",
133
- "yard --version '0.5.8'",
133
+ "yard --version '0.6.1'",
134
134
  "yard-sinatra --version '0.5.1'",
135
135
  "bluecloth --version '2.0.9'"
136
136
  ]
@@ -164,7 +164,7 @@ Please visit http://www.ruby-lang.org/ or http://rvm.beginrescueend.com/ for ins
164
164
 
165
165
  The following development gem dependencies could not be found. Without them, some available development features are missing:
166
166
  rspec --version '2.0.1'
167
- yard --version '0.5.8'
167
+ yard --version '0.6.1'
168
168
  bluecloth --version '2.0.9'
169
169
  MESSAGE
170
170
  end
File without changes
File without changes
@@ -0,0 +1,380 @@
1
+ # encoding: UTF-8
2
+ require "spec_helper"
3
+ require PROJECT_ROOT + "lib/mango/runner"
4
+
5
+ describe Mango::Runner do
6
+
7
+ #################################################################################################
8
+
9
+ describe "class methods and attributes" do
10
+ before(:all) do
11
+ @runner = Mango::Runner.new
12
+ end
13
+
14
+ it "is a kind of Thor" do
15
+ @runner.should be_a_kind_of(Thor)
16
+ end
17
+
18
+ it "is a kind of Thor::Actions" do
19
+ @runner.should be_a_kind_of(Thor::Actions)
20
+ end
21
+
22
+ it "adds runtime options" do
23
+ Mango::Runner.class_options.should have_key(:force)
24
+ Mango::Runner.class_options.should have_key(:pretend)
25
+ Mango::Runner.class_options.should have_key(:quiet)
26
+ Mango::Runner.class_options.should have_key(:skip)
27
+ end
28
+
29
+ it "has a source root" do
30
+ @runner.source_paths.should include (PROJECT_ROOT + "lib/mango/templates").to_s
31
+ end
32
+
33
+ it "has a create task" do
34
+ task = Mango::Runner.tasks["create"]
35
+ task.name.should == "create"
36
+ task.description.should == "Creates a new Mango application at the specified path"
37
+ end
38
+ end
39
+
40
+ #################################################################################################
41
+
42
+ describe "#create" do
43
+ before(:all) do
44
+ $stdout = StringIO.new
45
+ @runner = Mango::Runner.new
46
+ @runner.create(RUNNER_ROOT)
47
+ end
48
+
49
+ after(:all) do
50
+ RUNNER_ROOT.rmtree
51
+ $stdout = STDOUT
52
+ end
53
+
54
+ it "generates the destination root" do
55
+ RUNNER_ROOT.should be_a_directory
56
+ end
57
+
58
+ it "generates .gitignore" do
59
+ expected = RUNNER_ROOT + ".gitignore"
60
+ expected.should be_a_file
61
+ File.read(expected).should == <<-EOS
62
+ .DS_Store
63
+ .rvmrc
64
+ .bundle
65
+ EOS
66
+ end
67
+
68
+ it "generates config.ru" do
69
+ expected = RUNNER_ROOT + "config.ru"
70
+ expected.should be_a_file
71
+ File.read(expected).should == <<-EOS
72
+ # encoding: UTF-8
73
+ require "mango"
74
+ run Mango::Application
75
+ EOS
76
+ end
77
+
78
+ it "generates Gemfile" do
79
+ expected = RUNNER_ROOT + "Gemfile"
80
+ expected.should be_a_file
81
+ File.read(expected).should == <<-EOS
82
+ # encoding: UTF-8
83
+ source "http://rubygems.org"
84
+ gem "mango", "~> 0.5.0"
85
+ EOS
86
+ end
87
+
88
+ it "generates README.md" do
89
+ expected = RUNNER_ROOT + "README.md"
90
+ expected.should be_a_file
91
+ File.read(expected).should == <<-EOS
92
+ Your Mango Application Name
93
+ ===========================
94
+
95
+ Summary
96
+ -------
97
+
98
+
99
+
100
+ Getting Started
101
+ ---------------
102
+
103
+
104
+
105
+ Publishing
106
+ ----------
107
+
108
+
109
+
110
+ Credits
111
+ -------
112
+
113
+
114
+ EOS
115
+ end
116
+
117
+ ###############################################################################################
118
+
119
+ it "generates content/" do
120
+ (RUNNER_ROOT + "content").should be_a_directory
121
+ end
122
+
123
+ it "generates content/index.md" do
124
+ expected = RUNNER_ROOT + "content/index.md"
125
+ expected.should be_a_file
126
+ File.read(expected).should == <<-EOS
127
+ ---
128
+ title: Congratulations!
129
+ ---
130
+
131
+ ## You did it!
132
+ EOS
133
+ end
134
+
135
+ ###############################################################################################
136
+
137
+ it "generates themes/" do
138
+ (RUNNER_ROOT + "themes").should be_a_directory
139
+ end
140
+
141
+ it "generates themes/default" do
142
+ (RUNNER_ROOT + "themes/default").should be_a_directory
143
+ end
144
+
145
+ ###############################################################################################
146
+
147
+ it "generates themes/default/public" do
148
+ (RUNNER_ROOT + "themes/default/public").should be_a_directory
149
+ end
150
+
151
+ it "generates themes/default/public/favicon.ico" do
152
+ expected = RUNNER_ROOT + "themes/default/public/favicon.ico"
153
+ expected.should be_a_file
154
+ File.read(expected).should == ""
155
+ end
156
+
157
+ it "generates themes/default/public/robots.txt" do
158
+ expected = RUNNER_ROOT + "themes/default/public/robots.txt"
159
+ expected.should be_a_file
160
+ File.read(expected).should == <<-EOS
161
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
162
+ #
163
+ # To ban all spiders from the entire site uncomment the next two lines:
164
+ # User-Agent: *
165
+ # Disallow: /
166
+ EOS
167
+ end
168
+
169
+ ###############################################################################################
170
+
171
+ it "generates themes/default/public/images" do
172
+ (RUNNER_ROOT + "themes/default/public/images").should be_a_directory
173
+ end
174
+
175
+ it "generates themes/default/public/images" do
176
+ expected = RUNNER_ROOT + "themes/default/public/images/particles.gif"
177
+ expected.should be_a_file
178
+ File.open(expected, "rb") { |f| f.read.size.should == 2469 }
179
+ end
180
+
181
+ ###############################################################################################
182
+
183
+ it "generates themes/default/public/javascripts" do
184
+ (RUNNER_ROOT + "themes/default/public/javascripts").should be_a_directory
185
+ end
186
+
187
+ it "generates themes/default/public/javascripts/fireworks.js" do
188
+ expected = RUNNER_ROOT + "themes/default/public/javascripts/fireworks.js"
189
+ expected.should be_a_file
190
+ File.read(expected).size.should == 17167
191
+ end
192
+
193
+ it "generates themes/default/public/javascripts/timer.js" do
194
+ expected = RUNNER_ROOT + "themes/default/public/javascripts/timer.js"
195
+ expected.should be_a_file
196
+ File.read(expected).should == <<-EOS
197
+ function fire() {
198
+ var gap = Math.floor(Math.random() * 1201) + 600;
199
+ setTimeout("fire()", gap);
200
+ createFirework(30,125,7,5,null,null,null,null,false,true);
201
+ }
202
+ EOS
203
+ end
204
+
205
+ ###############################################################################################
206
+
207
+ it "generates themes/default/public/styles" do
208
+ (RUNNER_ROOT + "themes/default/public/styles").should be_a_directory
209
+ end
210
+
211
+ it "generates themes/default/public/styles/fireworks.css" do
212
+ expected = RUNNER_ROOT + "themes/default/public/styles/fireworks.css"
213
+ expected.should be_a_file
214
+ File.read(expected).size.should == 717
215
+ end
216
+
217
+ it "generates themes/default/public/styles/reset.css" do
218
+ expected = RUNNER_ROOT + "themes/default/public/styles/reset.css"
219
+ expected.should be_a_file
220
+ File.read(expected).should == <<-EOS
221
+ @charset "UTF-8";
222
+
223
+ /* v1.0 | 20080212 */
224
+
225
+ html, body, div, span, applet, object, iframe,
226
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
227
+ a, abbr, acronym, address, big, cite, code,
228
+ del, dfn, em, font, img, ins, kbd, q, s, samp,
229
+ small, strike, strong, sub, sup, tt, var,
230
+ b, u, i, center,
231
+ dl, dt, dd, ol, ul, li,
232
+ fieldset, form, label, legend,
233
+ table, caption, tbody, tfoot, thead, tr, th, td {
234
+ margin: 0;
235
+ padding: 0;
236
+ border: 0;
237
+ outline: 0;
238
+ font-size: 100%;
239
+ vertical-align: baseline;
240
+ background: transparent;
241
+ }
242
+ body {
243
+ line-height: 1;
244
+ }
245
+ ol, ul {
246
+ list-style: none;
247
+ }
248
+ blockquote, q {
249
+ quotes: none;
250
+ }
251
+ blockquote:before, blockquote:after,
252
+ q:before, q:after {
253
+ content: '';
254
+ content: none;
255
+ }
256
+
257
+ /* remember to define focus styles! */
258
+ :focus {
259
+ outline: 0;
260
+ }
261
+
262
+ /* remember to highlight inserts somehow! */
263
+ ins {
264
+ text-decoration: none;
265
+ }
266
+ del {
267
+ text-decoration: line-through;
268
+ }
269
+
270
+ /* tables still need 'cellspacing="0"' in the markup */
271
+ table {
272
+ border-collapse: collapse;
273
+ border-spacing: 0;
274
+ }
275
+ EOS
276
+ end
277
+
278
+ ###############################################################################################
279
+
280
+ it "generates themes/default/styles" do
281
+ (RUNNER_ROOT + "themes/default/styles").should be_a_directory
282
+ end
283
+
284
+ it "generates themes/default/styles/screen.sass" do
285
+ expected = RUNNER_ROOT + "themes/default/styles/screen.sass"
286
+ expected.should be_a_file
287
+ File.read(expected).should == <<-EOS
288
+ @charset "UTF-8"
289
+
290
+ body
291
+ background-color: #D05C12
292
+ font-family: "Lobster", arial, serif
293
+ margin: 0px auto
294
+ text-align: center
295
+ text-shadow: 2px 2px 5px #000
296
+
297
+ h1
298
+ color: #29B7DD
299
+ font-size: 90pt
300
+ margin: 60px 0px 100px 0px
301
+
302
+ h2
303
+ color: #FBAF0D
304
+ font-size: 240pt
305
+ EOS
306
+ end
307
+
308
+ ###############################################################################################
309
+
310
+ it "generates themes/default/views" do
311
+ (RUNNER_ROOT + "themes/default/views").should be_a_directory
312
+ end
313
+
314
+ it "generates themes/default/views/404.haml" do
315
+ expected = RUNNER_ROOT + "themes/default/views/404.haml"
316
+ expected.should be_a_file
317
+ File.read(expected).should == <<-EOS
318
+ !!! 5
319
+ %html
320
+ %head
321
+ %meta{ :charset => "utf-8" }
322
+ %title The page you were looking for doesn't exist (404)
323
+ :css
324
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
325
+ div.dialog {
326
+ width: 25em;
327
+ padding: 0 4em;
328
+ margin: 4em auto 0 auto;
329
+ border: 1px solid #ccc;
330
+ border-right-color: #999;
331
+ border-bottom-color: #999;
332
+ }
333
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
334
+ %body
335
+ / This file lives in themes/default/views/404.haml
336
+ %div.dialog
337
+ %h1 The page you were looking for doesn't exist.
338
+ %p You may have mistyped the address or the page may have moved.
339
+ EOS
340
+ end
341
+
342
+ it "generates themes/default/views/layout.haml" do
343
+ expected = RUNNER_ROOT + "themes/default/views/layout.haml"
344
+ expected.should be_a_file
345
+ File.read(expected).should == <<-EOS
346
+ !!! 5
347
+ %html
348
+ %head
349
+ %meta{ :charset => "utf-8" }
350
+ %title= "Mango: \#{@content_page.title}"
351
+ %link{ :rel => "stylesheet", :type => "text/css", :media => "screen", :href => "http://fonts.googleapis.com/css?family=Lobster" }
352
+ %link{ :rel => "stylesheet", :type => "text/css", :media => "screen", :href => "/styles/reset.css" }
353
+ %link{ :rel => "stylesheet", :type => "text/css", :media => "screen", :href => "/styles/screen.css" }
354
+ %link{ :rel => "stylesheet", :type => "text/css", :media => "screen", :href => "/styles/fireworks.css" }
355
+ %script{ :type => "text/javascript", :src => "/javascripts/fireworks.js"}
356
+ %script{ :type => "text/javascript", :src => "/javascripts/timer.js"}
357
+ %body{ :onload => "fire();" }
358
+ %div#fireworks-template
359
+ %div#fw.firework
360
+ %div#fp.fireworkParticle
361
+ %img{ :src => "/images/particles.gif" }
362
+
363
+ %div#fireContainer
364
+
365
+ = yield
366
+ EOS
367
+ end
368
+
369
+ it "generates themes/default/views/page.haml" do
370
+ expected = RUNNER_ROOT + "themes/default/views/page.haml"
371
+ expected.should be_a_file
372
+ File.read(expected).should == <<-EOS
373
+ %h1= @content_page.title
374
+
375
+ = @content_page.to_html
376
+ EOS
377
+ end
378
+
379
+ end
380
+ end