@@ -91,14 +91,19 @@ def app
91
91
get "/collections/posts/entries/"
92
92
expect ( last_response ) . to be_ok
93
93
expect ( entries . first [ "type" ] ) . to eq ( "directory" )
94
- expect ( entries . first [ "name" ] ) . to eq ( "test " )
94
+ expect ( entries . first [ "name" ] ) . to eq ( "more posts " )
95
95
end
96
96
97
97
it "lists documents in subdirectories" do
98
- get "/collections/posts/entries/test/other /"
98
+ get "/collections/posts/entries/more%20posts/some%20more%20posts /"
99
99
expect ( last_response ) . to be_ok
100
- expect ( first_document [ "id" ] ) . to eq ( "/2016/05/02/test" )
101
- expect ( first_document [ "path" ] ) . to eq ( "_posts/test/other/2016-05-02-test.md" )
100
+ expect ( first_document [ "id" ] )
101
+ . to eq ( "/2016/05/02/another-test-post-within-subdirectory" )
102
+ expect ( first_document [ "path" ] )
103
+ . to eq (
104
+ "_posts/more posts/some more " \
105
+ "posts/2016-05-02-another-test-post-within-subdirectory.md"
106
+ )
102
107
end
103
108
end
104
109
end
@@ -110,21 +115,21 @@ def app
110
115
111
116
context "getting a single document" do
112
117
it "returns a collection document" do
113
- get "/collections/posts/2016-01-01-test.md"
118
+ get "/collections/posts/2016-01-01-test-post .md"
114
119
expect ( last_response ) . to be_ok
115
- expect ( last_response_parsed [ "title" ] ) . to eq ( "Test" )
120
+ expect ( last_response_parsed [ "title" ] ) . to eq ( "Test Post " )
116
121
end
117
122
118
123
it "returns a collection document in subdirectories" do
119
- get "/collections/posts/test /2016-04-01-test .md"
124
+ get "/collections/posts/more%20posts /2016-04-01-post-within-subdirectory .md"
120
125
expect ( last_response ) . to be_ok
121
- expect ( last_response_parsed [ "title" ] ) . to eq ( "Test " )
126
+ expect ( last_response_parsed [ "title" ] ) . to eq ( "Post Within Subdirectory " )
122
127
end
123
128
124
129
it "returns a collection document using the slashed ID" do
125
- get "/collections/posts/2016/01/01/ test.md"
130
+ get "/collections/posts/2016-01-01- test-post .md"
126
131
expect ( last_response ) . to be_ok
127
- expect ( last_response_parsed [ "title" ] ) . to eq ( "Test" )
132
+ expect ( last_response_parsed [ "title" ] ) . to eq ( "Test Post " )
128
133
end
129
134
130
135
it "returns a non-dated document" do
@@ -140,29 +145,29 @@ def app
140
145
end
141
146
142
147
it "returns the rendered output" do
143
- get "/collections/posts/2016-01-01-test.md"
148
+ get "/collections/posts/2016-01-01-test-post .md"
144
149
expect ( last_response ) . to be_ok
145
150
expected = "<h1 id=\" test-post\" >Test Post</h1>\n "
146
151
expect ( last_response_parsed [ "content" ] ) . to eq ( expected )
147
152
end
148
153
149
154
it "returns the raw content" do
150
- get "/collections/posts/2016-01-01-test.md"
155
+ get "/collections/posts/2016-01-01-test-post .md"
151
156
expect ( last_response ) . to be_ok
152
157
expect ( last_response_parsed [ "raw_content" ] ) . to eq ( "# Test Post\n " )
153
158
end
154
159
155
160
%w( next previous ) . each do |direction |
156
161
it "includes the #{ direction } document non-recursively" do
157
- get "/collections/posts/2016-02-01-test.md"
162
+ get "/collections/posts/2016-02-01-test-post-2 .md"
158
163
expect ( last_response ) . to be_ok
159
164
expect ( last_response_parsed ) . to have_key ( direction )
160
165
expect ( last_response_parsed [ direction ] ) . to_not have_key ( "next" )
161
166
expect ( last_response_parsed [ direction ] ) . to_not have_key ( "previous" )
162
167
end
163
168
164
169
it "doesn't include the #{ direction } document's content" do
165
- get "/collections/posts/2016-02-01-test.md"
170
+ get "/collections/posts/2016-02-01-test-post-2 .md"
166
171
expect ( last_response ) . to be_ok
167
172
expect ( last_response_parsed ) . to have_key ( direction )
168
173
expect ( last_response_parsed [ direction ] ) . to_not have_key ( "content" )
@@ -175,18 +180,18 @@ def app
175
180
let ( :front_matter ) { last_response_parsed [ "front_matter" ] }
176
181
177
182
it "contains front matter defaults" do
178
- get "/collections/posts/2016-01-01-test.md"
183
+ get "/collections/posts/2016-01-01-test-post .md"
179
184
expect ( last_response_parsed . key? ( "some_front_matter" ) ) . to eql ( true )
180
185
end
181
186
182
187
it "contains raw front matter" do
183
- get "/collections/posts/2016-01-01-test.md"
188
+ get "/collections/posts/2016-01-01-test-post .md"
184
189
expect ( last_response_parsed . key? ( "front_matter" ) ) . to eql ( true )
185
190
expect ( front_matter [ "foo" ] ) . to eql ( "bar" )
186
191
end
187
192
188
193
it "raw front matter doesn't contain defaults" do
189
- get "/collections/posts/2016-01-01-test.md"
194
+ get "/collections/posts/2016-01-01-test-post .md"
190
195
expect ( front_matter . key? ( "some_front_matter" ) ) . to eql ( false )
191
196
end
192
197
end
@@ -234,19 +239,19 @@ def app
234
239
end
235
240
236
241
it "writes a new file in subdirectories" do
237
- delete_file "_posts/test /2016-01-01-test2.md"
242
+ delete_file "_posts/more posts /2016-01-01-test2.md"
238
243
239
244
request = {
240
245
:front_matter => { :foo => "bar" } ,
241
246
:raw_content => "test" ,
242
247
}
243
- put "/collections/posts/test /2016-01-01-test2.md" , request . to_json
248
+ put "/collections/posts/more%20posts /2016-01-01-test2.md" , request . to_json
244
249
245
250
expect ( last_response ) . to be_ok
246
251
expect ( last_response_parsed [ "foo" ] ) . to eq ( "bar" )
247
- expect ( "_posts/test /2016-01-01-test2.md" ) . to be_an_existing_file
252
+ expect ( "_posts/more posts /2016-01-01-test2.md" ) . to be_an_existing_file
248
253
249
- delete_file "_posts/test /2016-01-01-test2.md"
254
+ delete_file "_posts/more posts /2016-01-01-test2.md"
250
255
end
251
256
252
257
it "updates a file" do
@@ -266,19 +271,19 @@ def app
266
271
end
267
272
268
273
it "updates a file in subdirectories" do
269
- write_file "_posts/test /2016-01-01-test2.md"
274
+ write_file "_posts/more posts /2016-01-01-test2.md"
270
275
271
276
request = {
272
277
:front_matter => { :foo => "bar2" } ,
273
278
:raw_content => "test" ,
274
279
}
275
- put "/collections/posts/test /2016-01-01-test2.md" , request . to_json
280
+ put "/collections/posts/more%20posts /2016-01-01-test2.md" , request . to_json
276
281
277
282
expect ( last_response ) . to be_ok
278
283
expect ( last_response_parsed [ "foo" ] ) . to eq ( "bar2" )
279
- expect ( "_posts/test /2016-01-01-test2.md" ) . to be_an_existing_file
284
+ expect ( "_posts/more posts /2016-01-01-test2.md" ) . to be_an_existing_file
280
285
281
- delete_file "_posts/test /2016-01-01-test2.md"
286
+ delete_file "_posts/more posts /2016-01-01-test2.md"
282
287
end
283
288
284
289
it "writes a new file with a future date" do
@@ -326,28 +331,31 @@ def app
326
331
end
327
332
328
333
it "renames a file in subdirectories" do
329
- write_file "_posts/test /2016-01-01-test2.md"
330
- delete_file "_posts/test /2016-01-02-test2.md"
334
+ write_file "_posts/more posts /2016-01-01-test2.md"
335
+ delete_file "_posts/more posts /2016-01-02-test2.md"
331
336
332
- path = "_posts/test /2016-01-02-test2.md"
337
+ path = "_posts/more posts /2016-01-02-test2.md"
333
338
request = {
334
339
:path => path ,
335
340
:front_matter => { :foo => "bar2" } ,
336
341
:raw_content => "test" ,
337
342
}
338
343
339
- put "/collections/posts/test /2016-01-01-test2.md" , request . to_json
344
+ put "/collections/posts/more%20posts /2016-01-01-test2.md" , request . to_json
340
345
expect ( last_response ) . to be_ok
341
346
expect ( last_response_parsed [ "foo" ] ) . to eq ( "bar2" )
342
347
343
- get "/collections/posts/test /2016-01-02-test2.md" , request . to_json
348
+ get "/collections/posts/more%20posts /2016-01-02-test2.md" , request . to_json
344
349
expect ( last_response ) . to be_ok
345
350
expect ( last_response_parsed [ "foo" ] ) . to eq ( "bar2" )
346
351
347
- expect ( "_posts/test /2016-01-01-test2.md" ) . to_not be_an_existing_file
348
- expect ( "_posts/test /2016-01-02-test2.md" ) . to be_an_existing_file
352
+ expect ( "_posts/more posts /2016-01-01-test2.md" ) . to_not be_an_existing_file
353
+ expect ( "_posts/more posts /2016-01-02-test2.md" ) . to be_an_existing_file
349
354
350
- delete_file "_posts/test/2016-01-01-test2.md" , "_posts/test/2016-01-02-test2.md"
355
+ delete_file (
356
+ "_posts/more posts/2016-01-01-test2.md" ,
357
+ "_posts/more posts/2016-01-02-test2.md"
358
+ )
351
359
end
352
360
end
353
361
@@ -359,10 +367,11 @@ def app
359
367
end
360
368
361
369
it "deletes a file in subdirectories" do
362
- write_file "_posts/test/other /2017-01-01-test.md"
363
- delete "/collections/posts/test/other /2017-01-01-test.md"
370
+ write_file "_posts/more posts/some more posts /2017-01-01-test.md"
371
+ delete "/collections/posts/more%20posts/some%20more%20posts /2017-01-01-test.md"
364
372
expect ( last_response ) . to be_ok
365
- expect ( "_posts/test/other/2017-01-01-test.md" ) . to_not be_an_existing_file
366
- delete_file "_posts/test/other/2017-01-01-test.md"
373
+ expect ( "_posts/more posts/some more posts/2017-01-01-test.md" )
374
+ . to_not be_an_existing_file
375
+ delete_file "_posts/more posts/some more posts/2017-01-01-test.md"
367
376
end
368
377
end
0 commit comments