mango 0.5.0.beta1 → 0.5.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,15 +16,15 @@ describe Mango::Application do
16
16
  get "/robots.txt"
17
17
  end
18
18
 
19
- it "should return 200 status code" do
19
+ it "returns 200 status code" do
20
20
  last_response.should be_ok
21
21
  end
22
22
 
23
- it "should send the correct Content-Type header" do
23
+ it "sends the correct Content-Type header" do
24
24
  last_response["Content-Type"] == "text/plain"
25
25
  end
26
26
 
27
- it "should send the correct body content" do
27
+ it "sends the correct body content" do
28
28
  last_response.body.should == <<-EXPECTED
29
29
  User-agent: *
30
30
  Disallow: /cgi-bin/
@@ -39,15 +39,15 @@ Disallow: /cgi-bin/
39
39
  get "/images/index.html"
40
40
  end
41
41
 
42
- it "should return 200 status code" do
42
+ it "returns 200 status code" do
43
43
  last_response.should be_ok
44
44
  end
45
45
 
46
- it "should send the correct Content-Type header" do
46
+ it "sends the correct Content-Type header" do
47
47
  last_response["Content-Type"] == "text/html"
48
48
  end
49
49
 
50
- it "should send the correct body content" do
50
+ it "sends the correct body content" do
51
51
  last_response.body.should == <<-EXPECTED
52
52
  <!DOCTYPE html>
53
53
  <html>
@@ -70,15 +70,15 @@ Disallow: /cgi-bin/
70
70
  get "/images/ripe-mango.jpg"
71
71
  end
72
72
 
73
- it "should return 200 status code" do
73
+ it "returns 200 status code" do
74
74
  last_response.should be_ok
75
75
  end
76
76
 
77
- it "should send the correct Content-Type header" do
77
+ it "sends the correct Content-Type header" do
78
78
  last_response["Content-Type"] == "image/jpeg"
79
79
  end
80
80
 
81
- it "should send the correct body content" do
81
+ it "sends the correct body content" do
82
82
  content_path = File.join(Mango::Application.public, "images", "ripe-mango.jpg")
83
83
  last_response.body.should == File.open(content_path, "rb").read
84
84
  end
@@ -91,15 +91,15 @@ Disallow: /cgi-bin/
91
91
  get "/override"
92
92
  end
93
93
 
94
- it "should return 200 status code" do
94
+ it "returns 200 status code" do
95
95
  last_response.should be_ok
96
96
  end
97
97
 
98
- it "should send the correct Content-Type header" do
98
+ it "sends the correct Content-Type header" do
99
99
  last_response["Content-Type"] == "text/html"
100
100
  end
101
101
 
102
- it "should send the correct body content" do
102
+ it "sends the correct body content" do
103
103
  last_response.body.should == <<-EXPECTED
104
104
  <!DOCTYPE html>
105
105
  <html>
@@ -123,15 +123,15 @@ Disallow: /cgi-bin/
123
123
  get "/images/"
124
124
  end
125
125
 
126
- it "should return 200 status code" do
126
+ it "returns 200 status code" do
127
127
  last_response.should be_ok
128
128
  end
129
129
 
130
- it "should send the correct Content-Type header" do
130
+ it "sends the correct Content-Type header" do
131
131
  last_response["Content-Type"] == "text/html"
132
132
  end
133
133
 
134
- it "should send the correct body content" do
134
+ it "sends the correct body content" do
135
135
  last_response.body.should == <<-EXPECTED
136
136
  <!DOCTYPE html>
137
137
  <html>
@@ -154,15 +154,15 @@ Disallow: /cgi-bin/
154
154
  get "/../security_hole.txt"
155
155
  end
156
156
 
157
- it "should return 404 status code" do
157
+ it "returns 404 status code" do
158
158
  last_response.should be_not_found
159
159
  end
160
160
 
161
- it "should send the correct Content-Type header" do
161
+ it "sends the correct Content-Type header" do
162
162
  last_response["Content-Type"] == "text/html"
163
163
  end
164
164
 
165
- it "should send the correct body content" do
165
+ it "sends the correct body content" do
166
166
  last_response.body.should == <<-EXPECTED
167
167
  <!DOCTYPE html>
168
168
  <html>
@@ -16,15 +16,15 @@ describe Mango::Application do
16
16
  get "/styles/screen.css"
17
17
  end
18
18
 
19
- it "should return 200 status code" do
19
+ it "returns 200 status code" do
20
20
  last_response.should be_ok
21
21
  end
22
22
 
23
- it "should send the correct Content-Type header" do
23
+ it "sends the correct Content-Type header" do
24
24
  last_response["Content-Type"].should == "text/css"
25
25
  end
26
26
 
27
- it "should send the correct body content" do
27
+ it "sends the correct body content" do
28
28
  last_response.body.should == <<-EXPECTED
29
29
  @charset "UTF-8";
30
30
  .content-navigation {
@@ -46,15 +46,15 @@ describe Mango::Application do
46
46
  get "/styles/subfolder/screen.css"
47
47
  end
48
48
 
49
- it "should return 200 status code" do
49
+ it "returns 200 status code" do
50
50
  last_response.should be_ok
51
51
  end
52
52
 
53
- it "should send the correct Content-Type header" do
53
+ it "sends the correct Content-Type header" do
54
54
  last_response["Content-Type"].should == "text/css"
55
55
  end
56
56
 
57
- it "should send the correct body content" do
57
+ it "sends the correct body content" do
58
58
  last_response.body.should == <<-EXPECTED
59
59
  @charset "UTF-8";
60
60
  table.hl {
@@ -77,15 +77,15 @@ li {
77
77
  get "/styles/reset.css"
78
78
  end
79
79
 
80
- it "should return 200 status code" do
80
+ it "returns 200 status code" do
81
81
  last_response.should be_ok
82
82
  end
83
83
 
84
- it "should send the correct Content-Type header" do
84
+ it "sends the correct Content-Type header" do
85
85
  last_response["Content-Type"].should == "text/css"
86
86
  end
87
87
 
88
- it "should send the correct body content" do
88
+ it "sends the correct body content" do
89
89
  last_response.body.should == <<-EXPECTED
90
90
  /*
91
91
  html5doctor.com Reset Stylesheet
@@ -125,15 +125,15 @@ time, mark, audio, video {
125
125
  get "/styles/override.css"
126
126
  end
127
127
 
128
- it "should return 200 status code" do
128
+ it "returns 200 status code" do
129
129
  last_response.should be_ok
130
130
  end
131
131
 
132
- it "should send the correct Content-Type header" do
132
+ it "sends the correct Content-Type header" do
133
133
  last_response["Content-Type"].should == "text/css"
134
134
  end
135
135
 
136
- it "should send the correct body content" do
136
+ it "sends the correct body content" do
137
137
  last_response.body.should == <<-EXPECTED
138
138
  #override {
139
139
  font-weight: bold;
@@ -149,15 +149,15 @@ time, mark, audio, video {
149
149
  get "/default.css"
150
150
  end
151
151
 
152
- it "should return 200 status code" do
152
+ it "returns 200 status code" do
153
153
  last_response.should be_ok
154
154
  end
155
155
 
156
- it "should send the correct Content-Type header" do
156
+ it "sends the correct Content-Type header" do
157
157
  last_response["Content-Type"].should == "text/css"
158
158
  end
159
159
 
160
- it "should send the correct body content" do
160
+ it "sends the correct body content" do
161
161
  last_response.body.should == <<-EXPECTED
162
162
  #default {
163
163
  background-color: black;
@@ -173,15 +173,15 @@ time, mark, audio, video {
173
173
  get "/styles/subfolder/another.css"
174
174
  end
175
175
 
176
- it "should return 200 status code" do
176
+ it "returns 200 status code" do
177
177
  last_response.should be_ok
178
178
  end
179
179
 
180
- it "should send the correct Content-Type header" do
180
+ it "sends the correct Content-Type header" do
181
181
  last_response["Content-Type"].should == "text/css"
182
182
  end
183
183
 
184
- it "should send the correct body content" do
184
+ it "sends the correct body content" do
185
185
  last_response.body.should == <<-EXPECTED
186
186
  #another {
187
187
  color: red;
@@ -197,15 +197,15 @@ time, mark, audio, video {
197
197
  get "/styles/style_not_found.css"
198
198
  end
199
199
 
200
- it "should return 404 status code" do
200
+ it "returns 404 status code" do
201
201
  last_response.should be_not_found
202
202
  end
203
203
 
204
- it "should send the correct Content-Type header" do
204
+ it "sends the correct Content-Type header" do
205
205
  last_response["Content-Type"].should == "text/html"
206
206
  end
207
207
 
208
- it "should send the correct body content" do
208
+ it "sends the correct body content" do
209
209
  last_response.body.should == <<-EXPECTED
210
210
  <!DOCTYPE html>
211
211
  <html>
@@ -228,15 +228,15 @@ time, mark, audio, video {
228
228
  get "/screen.css"
229
229
  end
230
230
 
231
- it "should return 404 status code" do
231
+ it "returns 404 status code" do
232
232
  last_response.should be_not_found
233
233
  end
234
234
 
235
- it "should send the correct Content-Type header" do
235
+ it "sends the correct Content-Type header" do
236
236
  last_response["Content-Type"].should == "text/html"
237
237
  end
238
238
 
239
- it "should send the correct body content" do
239
+ it "sends the correct body content" do
240
240
  last_response.body.should == <<-EXPECTED
241
241
  <!DOCTYPE html>
242
242
  <html>
@@ -259,15 +259,15 @@ time, mark, audio, video {
259
259
  get "/styles/../security_hole.css"
260
260
  end
261
261
 
262
- it "should return 404 status code" do
262
+ it "returns 404 status code" do
263
263
  last_response.should be_not_found
264
264
  end
265
265
 
266
- it "should send the correct Content-Type header" do
266
+ it "sends the correct Content-Type header" do
267
267
  last_response["Content-Type"].should == "text/html"
268
268
  end
269
269
 
270
- it "should send the correct body content" do
270
+ it "sends the correct body content" do
271
271
  last_response.body.should == <<-EXPECTED
272
272
  <!DOCTYPE html>
273
273
  <html>
@@ -11,11 +11,11 @@ describe Mango::ContentPage do
11
11
  @page = Mango::ContentPage.find_by_path(path)
12
12
  end
13
13
 
14
- it "should be an instance of Mango::ContentPage" do
14
+ it "is an instance of Mango::ContentPage" do
15
15
  @page.should be_instance_of(Mango::ContentPage)
16
16
  end
17
17
 
18
- it "should save the data" do
18
+ it "saves the data" do
19
19
  @page.data.should == <<-EOS
20
20
  ---
21
21
  title: Haml!
@@ -27,26 +27,26 @@ category:
27
27
  EOS
28
28
  end
29
29
 
30
- it "should detect content engine" do
30
+ it "detects the content engine" do
31
31
  @page.content_engine.should == :haml
32
32
  end
33
33
 
34
- it "should load attributes" do
34
+ it "loads the attributes" do
35
35
  @page.attributes.should have(3).items
36
36
  @page.attributes.should include("title" => "Haml!",)
37
37
  @page.attributes.should include("category" => ["content", "engine"])
38
38
  @page.attributes.should include("view" => :page)
39
39
  end
40
40
 
41
- it "should load body" do
41
+ it "loads the body" do
42
42
  @page.body.should == "%p /engines/haml.haml\n"
43
43
  end
44
44
 
45
- it "should convert to HTML" do
45
+ it "converts to HTML" do
46
46
  @page.to_html.should == "<p>/engines/haml.haml</p>\n"
47
47
  end
48
48
 
49
- it "should determine the view template's base file name" do
49
+ it "determines the view template's base file name" do
50
50
  @page.view.should == :page
51
51
  end
52
52
  end
@@ -59,11 +59,11 @@ category:
59
59
  @page = Mango::ContentPage.find_by_path(path)
60
60
  end
61
61
 
62
- it "should be an instance of Mango::ContentPage" do
62
+ it "is an instance of Mango::ContentPage" do
63
63
  @page.should be_instance_of(Mango::ContentPage)
64
64
  end
65
65
 
66
- it "should save the data" do
66
+ it "saves the data" do
67
67
  @page.data.should == <<-EOS
68
68
  ---
69
69
  title: Markdown!
@@ -75,26 +75,26 @@ category:
75
75
  EOS
76
76
  end
77
77
 
78
- it "should detect content engine" do
78
+ it "detects the content engine" do
79
79
  @page.content_engine.should == :markdown
80
80
  end
81
81
 
82
- it "should load attributes" do
82
+ it "loads the attributes" do
83
83
  @page.attributes.should have(3).items
84
84
  @page.attributes.should include("title" => "Markdown!",)
85
85
  @page.attributes.should include("category" => ["content", "engine"])
86
86
  @page.attributes.should include("view" => :page)
87
87
  end
88
88
 
89
- it "should load body" do
89
+ it "loads the body" do
90
90
  @page.body.should == "### /engines/md.md\n"
91
91
  end
92
92
 
93
- it "should convert to HTML" do
93
+ it "converts to HTML" do
94
94
  @page.to_html.should == "<h3>/engines/md.md</h3>"
95
95
  end
96
96
 
97
- it "should determine the view template's base file name" do
97
+ it "determines the view template's base file name" do
98
98
  @page.view.should == :page
99
99
  end
100
100
  end
@@ -107,11 +107,11 @@ category:
107
107
  @page = Mango::ContentPage.find_by_path(path)
108
108
  end
109
109
 
110
- it "should be an instance of Mango::ContentPage" do
110
+ it "is an instance of Mango::ContentPage" do
111
111
  @page.should be_instance_of(Mango::ContentPage)
112
112
  end
113
113
 
114
- it "should save the data" do
114
+ it "saves the data" do
115
115
  @page.data.should == <<-EOS
116
116
  ---
117
117
  title: Markdown!
@@ -123,26 +123,26 @@ category:
123
123
  EOS
124
124
  end
125
125
 
126
- it "should detect content engine" do
126
+ it "detects the content engine" do
127
127
  @page.content_engine.should == :markdown
128
128
  end
129
129
 
130
- it "should load attributes" do
130
+ it "loads the attributes" do
131
131
  @page.attributes.should have(3).items
132
132
  @page.attributes.should include("title" => "Markdown!",)
133
133
  @page.attributes.should include("category" => ["content", "engine"])
134
134
  @page.attributes.should include("view" => :page)
135
135
  end
136
136
 
137
- it "should load body" do
137
+ it "loads the body" do
138
138
  @page.body.should == "### /engines/mdown.mdown\n"
139
139
  end
140
140
 
141
- it "should convert to HTML" do
141
+ it "converts to HTML" do
142
142
  @page.to_html.should == "<h3>/engines/mdown.mdown</h3>"
143
143
  end
144
144
 
145
- it "should determine the view template's base file name" do
145
+ it "determines the view template's base file name" do
146
146
  @page.view.should == :page
147
147
  end
148
148
  end
@@ -155,11 +155,11 @@ category:
155
155
  @page = Mango::ContentPage.find_by_path(path)
156
156
  end
157
157
 
158
- it "should be an instance of Mango::ContentPage" do
158
+ it "is an instance of Mango::ContentPage" do
159
159
  @page.should be_instance_of(Mango::ContentPage)
160
160
  end
161
161
 
162
- it "should save the data" do
162
+ it "saves the data" do
163
163
  @page.data.should == <<-EOS
164
164
  ---
165
165
  title: Markdown!
@@ -171,26 +171,26 @@ category:
171
171
  EOS
172
172
  end
173
173
 
174
- it "should detect content engine" do
174
+ it "detects the content engine" do
175
175
  @page.content_engine.should == :markdown
176
176
  end
177
177
 
178
- it "should load attributes" do
178
+ it "loads the attributes" do
179
179
  @page.attributes.should have(3).items
180
180
  @page.attributes.should include("title" => "Markdown!",)
181
181
  @page.attributes.should include("category" => ["content", "engine"])
182
182
  @page.attributes.should include("view" => :page)
183
183
  end
184
184
 
185
- it "should load body" do
185
+ it "loads the body" do
186
186
  @page.body.should == "### /engines/markdown.markdown\n"
187
187
  end
188
188
 
189
- it "should convert to HTML" do
189
+ it "converts to HTML" do
190
190
  @page.to_html.should == "<h3>/engines/markdown.markdown</h3>"
191
191
  end
192
192
 
193
- it "should determine the view template's base file name" do
193
+ it "determines the view template's base file name" do
194
194
  @page.view.should == :page
195
195
  end
196
196
  end
@@ -202,7 +202,7 @@ category:
202
202
  @path = File.join(SPEC_APP_ROOT, "content", "unknown")
203
203
  end
204
204
 
205
- it "should raise exception" do
205
+ it "raises Mango::ContentPage::PageNotFound" do
206
206
  expected_message = "Unable to find content page for path -- #{@path}"
207
207
  lambda {
208
208
  Mango::ContentPage.find_by_path(@path)