|
43 | 43 | end |
44 | 44 |
|
45 | 45 | it "puts all the posts in the feed.xml file" do |
46 | | - expect(contents).to match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/ |
47 | | - expect(contents).to match /http:\/\/example\.org\/news\/2014\/03\/02\/march-the-second\.html/ |
48 | | - expect(contents).to match /http:\/\/example\.org\/news\/2013\/12\/12\/dec-the-second\.html/ |
| 46 | + expect(contents).to match "http://example.org/updates/2014/03/04/march-the-fourth.html" |
| 47 | + expect(contents).to match "http://example.org/news/2014/03/02/march-the-second.html" |
| 48 | + expect(contents).to match "http://example.org/news/2013/12/12/dec-the-second.html" |
49 | 49 | expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html" |
50 | | - expect(contents).to_not match /http:\/\/example\.org\/2016\/02\/09\/a-draft\.html/ |
| 50 | + expect(contents).to_not match "http://example.org/2016/02/09/a-draft.html" |
51 | 51 | end |
52 | 52 |
|
53 | 53 | it "does not include assets or any static files that aren't .html" do |
54 | | - expect(contents).not_to match /http:\/\/example\.org\/images\/hubot\.png/ |
55 | | - expect(contents).not_to match /http:\/\/example\.org\/feeds\/atom\.xml/ |
| 54 | + expect(contents).not_to match "http://example.org/images/hubot.png" |
| 55 | + expect(contents).not_to match "http://example.org/feeds/atom.xml" |
56 | 56 | end |
57 | 57 |
|
58 | 58 | it "preserves linebreaks in preformatted text in posts" do |
59 | | - expect(contents).to match %r!Line 1\nLine 2\nLine 3! |
| 59 | + expect(contents).to match "Line 1\nLine 2\nLine 3" |
60 | 60 | end |
61 | 61 |
|
62 | 62 | it "supports post author name as an object" do |
63 | | - expect(contents).to match /<author>\s*<name>Ben<\/name>\s*<email>ben@example.com<\/email>\s*<uri>http:\/\/ben.balter.com<\/uri>\s*<\/author>/ |
| 63 | + expect(contents).to match %r!<author>\s*<name>Ben</name>\s*<email>ben@example\.com</email>\s*<uri>http://ben\.balter\.com</uri>\s*</author>! |
64 | 64 | end |
65 | 65 |
|
66 | 66 | it "supports post author name as a string" do |
67 | | - expect(contents).to match /<author>\s*<name>Pat<\/name>\s*<\/author>/ |
| 67 | + expect(contents).to match %r!<author>\s*<name>Pat</name>\s*</author>! |
68 | 68 | end |
69 | 69 |
|
70 | 70 | it "does not output author tag no author is provided" do |
71 | | - expect(contents).not_to match /<author>\s*<name><\/name>\s*<\/author>/ |
| 71 | + expect(contents).not_to match %r!<author>\s*<name></name>\s*</author>! |
72 | 72 | end |
73 | 73 |
|
74 | 74 | it "does use author reference with data from _data/authors.yml" do |
75 | | - expect(contents).to match /<author>\s*<name>Garth<\/name>\s*<email>example@mail.com<\/email>\s*<uri>http:\/\/garthdb.com<\/uri>\s*<\/author>/ |
| 75 | + expect(contents).to match %r!<author>\s*<name>Garth</name>\s*<email>example@mail\.com</email>\s*<uri>http://garthdb\.com</uri>\s*</author>! |
76 | 76 | end |
77 | 77 |
|
78 | 78 | it "converts markdown posts to HTML" do |
79 | | - expect(contents).to match /<p>March the second!<\/p>/ |
| 79 | + expect(contents).to match %r!<p>March the second\!</p>! |
80 | 80 | end |
81 | 81 |
|
82 | 82 | it "uses last_modified_at where available" do |
83 | | - expect(contents).to match /<updated>2015-05-12T13:27:59\+00:00<\/updated>/ |
| 83 | + expect(contents).to match %r!<updated>2015-05-12T13:27:59\+00:00</updated>! |
84 | 84 | end |
85 | 85 |
|
86 | 86 | it "replaces newlines in posts to spaces" do |
87 | | - expect(contents).to match %r!<title type="html">The plugin will properly strip newlines.</title>! |
| 87 | + expect(contents).to match '<title type="html">The plugin will properly strip newlines.</title>' |
88 | 88 | end |
89 | 89 |
|
90 | 90 | it "renders Liquid inside posts" do |
91 | | - expect(contents).to match %r!Liquid is rendered\.! |
92 | | - expect(contents).not_to match %r!Liquid is not rendered\.! |
| 91 | + expect(contents).to match "Liquid is rendered." |
| 92 | + expect(contents).not_to match "Liquid is not rendered." |
93 | 93 | end |
94 | 94 |
|
95 | 95 | it "includes the item image" do |
|
239 | 239 | end |
240 | 240 |
|
241 | 241 | it "correctly adds the baseurl to the posts" do |
242 | | - expect(contents).to match /http:\/\/example\.org\/bass\/updates\/2014\/03\/04\/march-the-fourth\.html/ |
243 | | - expect(contents).to match /http:\/\/example\.org\/bass\/news\/2014\/03\/02\/march-the-second\.html/ |
244 | | - expect(contents).to match /http:\/\/example\.org\/bass\/news\/2013\/12\/12\/dec-the-second\.html/ |
| 242 | + expect(contents).to match "http://example.org/bass/updates/2014/03/04/march-the-fourth.html" |
| 243 | + expect(contents).to match "http://example.org/bass/news/2014/03/02/march-the-second.html" |
| 244 | + expect(contents).to match "http://example.org/bass/news/2013/12/12/dec-the-second.html" |
245 | 245 | end |
246 | 246 |
|
247 | 247 | it "renders the feed meta" do |
|
258 | 258 |
|
259 | 259 | context "with a blank site name" do |
260 | 260 | let(:config) do |
261 | | - Jekyll.configuration({ |
| 261 | + Jekyll.configuration( |
262 | 262 | "source" => source_dir, |
263 | 263 | "destination" => dest_dir, |
264 | | - "url" => "http://example.org", |
265 | | - }) |
| 264 | + "url" => "http://example.org" |
| 265 | + ) |
266 | 266 | end |
267 | 267 |
|
268 | 268 | it "does not output blank title" do |
|
296 | 296 | "feed" => { |
297 | 297 | "collections" => { |
298 | 298 | "posts" => { |
299 | | - "path" => "atom.xml" |
300 | | - } |
301 | | - } |
| 299 | + "path" => "atom.xml", |
| 300 | + }, |
| 301 | + }, |
302 | 302 | }, |
303 | 303 | } |
304 | 304 | end |
|
323 | 323 | let(:overrides) { { "lang" => "en-US" } } |
324 | 324 |
|
325 | 325 | it "should set the language" do |
326 | | - expect(contents).to match %r!type="text/html" hreflang="en-US" />! |
| 326 | + expect(contents).to match 'type="text/html" hreflang="en-US" />' |
327 | 327 | end |
328 | 328 | end |
329 | 329 |
|
330 | 330 | context "with post.lang set" do |
331 | 331 | it "should set the language for that entry" do |
332 | | - expect(contents).to match %r!<entry xml:lang="en">! |
333 | | - expect(contents).to match %r!<entry>! |
| 332 | + expect(contents).to match '<entry xml:lang="en">' |
| 333 | + expect(contents).to match '<entry>' |
334 | 334 | end |
335 | 335 | end |
336 | 336 |
|
337 | 337 | context "categories" do |
338 | 338 | context "with top-level post categories" do |
339 | | - let(:overrides) { |
| 339 | + let(:overrides) do |
340 | 340 | { |
341 | | - "feed" => { "categories" => ["news"] } |
| 341 | + "feed" => { "categories" => ["news"] }, |
342 | 342 | } |
343 | | - } |
| 343 | + end |
344 | 344 | let(:news_feed) { File.read(dest_dir("feed/news.xml")) } |
345 | 345 |
|
346 | 346 | it "outputs the primary feed" do |
347 | | - expect(contents).to match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/ |
348 | | - expect(contents).to match /http:\/\/example\.org\/news\/2014\/03\/02\/march-the-second\.html/ |
349 | | - expect(contents).to match /http:\/\/example\.org\/news\/2013\/12\/12\/dec-the-second\.html/ |
| 347 | + expect(contents).to match "http://example.org/updates/2014/03/04/march-the-fourth.html" |
| 348 | + expect(contents).to match "http://example.org/news/2014/03/02/march-the-second.html" |
| 349 | + expect(contents).to match "http://example.org/news/2013/12/12/dec-the-second.html" |
350 | 350 | expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html" |
351 | | - expect(contents).to_not match /http:\/\/example\.org\/2016\/02\/09\/a-draft\.html/ |
| 351 | + expect(contents).to_not match "http://example.org/2016/02/09/a-draft.html" |
352 | 352 | end |
353 | 353 |
|
354 | 354 | it "outputs the category feed" do |
355 | | - expect(news_feed).to match "<title type=\"html\">My awesome site | News</title>" |
356 | | - expect(news_feed).to match /http:\/\/example\.org\/news\/2014\/03\/02\/march-the-second\.html/ |
357 | | - expect(news_feed).to match /http:\/\/example\.org\/news\/2013\/12\/12\/dec-the-second\.html/ |
358 | | - expect(news_feed).to_not match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/ |
| 355 | + expect(news_feed).to match '<title type="html">My awesome site | News</title>' |
| 356 | + expect(news_feed).to match "http://example.org/news/2014/03/02/march-the-second.html" |
| 357 | + expect(news_feed).to match "http://example.org/news/2013/12/12/dec-the-second.html" |
| 358 | + expect(news_feed).to_not match "http://example.org/updates/2014/03/04/march-the-fourth.html" |
359 | 359 | expect(news_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html" |
360 | 360 | end |
361 | 361 | end |
362 | 362 |
|
363 | 363 | context "with collection-level post categories" do |
364 | | - let(:overrides) { |
| 364 | + let(:overrides) do |
365 | 365 | { |
366 | 366 | "feed" => { |
367 | 367 | "collections" => { |
368 | 368 | "posts" => { |
369 | | - "categories" => ["news"] |
370 | | - } |
371 | | - } |
372 | | - } |
| 369 | + "categories" => ["news"], |
| 370 | + }, |
| 371 | + }, |
| 372 | + }, |
373 | 373 | } |
374 | | - } |
| 374 | + end |
375 | 375 | let(:news_feed) { File.read(dest_dir("feed/news.xml")) } |
376 | 376 |
|
377 | 377 | it "outputs the primary feed" do |
378 | | - expect(contents).to match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/ |
379 | | - expect(contents).to match /http:\/\/example\.org\/news\/2014\/03\/02\/march-the-second\.html/ |
380 | | - expect(contents).to match /http:\/\/example\.org\/news\/2013\/12\/12\/dec-the-second\.html/ |
| 378 | + expect(contents).to match "http://example.org/updates/2014/03/04/march-the-fourth.html" |
| 379 | + expect(contents).to match "http://example.org/news/2014/03/02/march-the-second.html" |
| 380 | + expect(contents).to match "http://example.org/news/2013/12/12/dec-the-second.html" |
381 | 381 | expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html" |
382 | | - expect(contents).to_not match /http:\/\/example\.org\/2016\/02\/09\/a-draft\.html/ |
| 382 | + expect(contents).to_not match "http://example.org/2016/02/09/a-draft.html" |
383 | 383 | end |
384 | 384 |
|
385 | 385 | it "outputs the category feed" do |
386 | | - expect(news_feed).to match "<title type=\"html\">My awesome site | News</title>" |
387 | | - expect(news_feed).to match /http:\/\/example\.org\/news\/2014\/03\/02\/march-the-second\.html/ |
388 | | - expect(news_feed).to match /http:\/\/example\.org\/news\/2013\/12\/12\/dec-the-second\.html/ |
389 | | - expect(news_feed).to_not match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/ |
| 386 | + expect(news_feed).to match '<title type="html">My awesome site | News</title>' |
| 387 | + expect(news_feed).to match "http://example.org/news/2014/03/02/march-the-second.html" |
| 388 | + expect(news_feed).to match "http://example.org/news/2013/12/12/dec-the-second.html" |
| 389 | + expect(news_feed).to_not match "http://example.org/updates/2014/03/04/march-the-fourth.html" |
390 | 390 | expect(news_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html" |
391 | 391 | end |
392 | 392 | end |
|
396 | 396 | let(:collection_feed) { File.read(dest_dir("feed/collection.xml")) } |
397 | 397 |
|
398 | 398 | context "when initialized as an array" do |
399 | | - let(:overrides) { |
| 399 | + let(:overrides) do |
400 | 400 | { |
401 | 401 | "collections" => { |
402 | 402 | "collection" => { |
403 | | - "output" => true |
404 | | - } |
| 403 | + "output" => true, |
| 404 | + }, |
405 | 405 | }, |
406 | | - "feed" => { "collections" => ["collection"] } |
| 406 | + "feed" => { "collections" => ["collection"] }, |
407 | 407 | } |
408 | | - } |
409 | | - |
| 408 | + end |
410 | 409 |
|
411 | 410 | it "outputs the collection feed" do |
412 | | - expect(collection_feed).to match "<title type=\"html\">My awesome site | Collection</title>" |
| 411 | + expect(collection_feed).to match '<title type="html">My awesome site | Collection</title>' |
413 | 412 | expect(collection_feed).to match "http://example.org/collection/2018-01-01-collection-doc.html" |
414 | 413 | expect(collection_feed).to match "http://example.org/collection/2018-01-02-collection-category-doc.html" |
415 | | - expect(collection_feed).to_not match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/ |
| 414 | + expect(collection_feed).to_not match "http://example.org/updates/2014/03/04/march-the-fourth.html" |
416 | 415 | expect(collection_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html" |
417 | 416 | end |
418 | 417 | end |
419 | 418 |
|
420 | 419 | context "with categories" do |
421 | | - let(:overrides) { |
| 420 | + let(:overrides) do |
422 | 421 | { |
423 | 422 | "collections" => { |
424 | 423 | "collection" => { |
425 | | - "output" => true |
426 | | - } |
| 424 | + "output" => true, |
| 425 | + }, |
427 | 426 | }, |
428 | | - "feed" => { |
| 427 | + "feed" => { |
429 | 428 | "collections" => { |
430 | 429 | "collection" => { |
431 | | - "categories" => ["news"] |
432 | | - } |
433 | | - } |
434 | | - } |
| 430 | + "categories" => ["news"], |
| 431 | + }, |
| 432 | + }, |
| 433 | + }, |
435 | 434 | } |
436 | | - } |
| 435 | + end |
437 | 436 | let(:news_feed) { File.read(dest_dir("feed/collection/news.xml")) } |
438 | 437 |
|
439 | 438 | it "outputs the collection category feed" do |
440 | | - expect(news_feed).to match "<title type=\"html\">My awesome site | Collection | News</title>" |
| 439 | + expect(news_feed).to match '<title type="html">My awesome site | Collection | News</title>' |
441 | 440 | expect(news_feed).to match "http://example.org/collection/2018-01-02-collection-category-doc.html" |
442 | 441 | expect(news_feed).to_not match "http://example.org/collection/2018-01-01-collection-doc.html" |
443 | | - expect(news_feed).to_not match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/ |
| 442 | + expect(news_feed).to_not match "http://example.org/updates/2014/03/04/march-the-fourth.html" |
444 | 443 | expect(news_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html" |
445 | 444 | end |
446 | 445 | end |
447 | 446 |
|
448 | 447 | context "with a custom path" do |
449 | | - let(:overrides) { |
| 448 | + let(:overrides) do |
450 | 449 | { |
451 | 450 | "collections" => { |
452 | 451 | "collection" => { |
453 | | - "output" => true |
454 | | - } |
| 452 | + "output" => true, |
| 453 | + }, |
455 | 454 | }, |
456 | | - "feed" => { |
| 455 | + "feed" => { |
457 | 456 | "collections" => { |
458 | 457 | "collection" => { |
459 | 458 | "categories" => ["news"], |
460 | | - "path" => "custom.xml" |
461 | | - } |
462 | | - } |
463 | | - } |
| 459 | + "path" => "custom.xml", |
| 460 | + }, |
| 461 | + }, |
| 462 | + }, |
464 | 463 | } |
465 | | - } |
| 464 | + end |
466 | 465 |
|
467 | 466 | it "should write to the custom path" do |
468 | 467 | expect(Pathname.new(dest_dir("custom.xml"))).to exist |
|
0 commit comments