|
269 | 269 | expect(feed_meta).not_to include("title=")
|
270 | 270 | end
|
271 | 271 | end
|
272 |
| - context "with a collection" do |
273 |
| - let(:overrides) do |
274 |
| - { |
275 |
| - "collections" => { |
276 |
| - "collection" => { |
277 |
| - "output" => true, |
278 |
| - }, |
279 |
| - }, |
280 |
| - "feed" => { |
281 |
| - "collections" => { |
282 |
| - "collection" => { |
283 |
| - "categories" => ["news"], |
284 |
| - }, |
285 |
| - }, |
286 |
| - }, |
287 |
| - } |
288 |
| - end |
289 |
| - it "renders a feed meta for each collection" do |
290 |
| - default_feed = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed.xml" title="My awesome site" />' |
291 |
| - collection_feed = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection.xml" title="My awesome site" />' |
292 |
| - category_feed = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection/news.xml" title="My awesome site" />' |
293 |
| - expect(feed_meta).to include(default_feed) |
294 |
| - expect(feed_meta).to include(collection_feed) |
295 |
| - expect(feed_meta).to include(category_feed) |
296 |
| - end |
297 |
| - end |
298 | 272 | end
|
299 | 273 |
|
300 | 274 | context "changing the feed path" do
|
|
339 | 313 | end
|
340 | 314 | end
|
341 | 315 |
|
| 316 | + context "selecting a particular collection" do |
| 317 | + let(:overrides) do |
| 318 | + { |
| 319 | + "collections" => { |
| 320 | + "collection" => { |
| 321 | + "output" => true, |
| 322 | + }, |
| 323 | + }, |
| 324 | + "feed" => { |
| 325 | + "collections" => { |
| 326 | + "collection" => { |
| 327 | + "categories" => ["news"], |
| 328 | + }, |
| 329 | + }, |
| 330 | + }, |
| 331 | + } |
| 332 | + end |
| 333 | + let(:default_feed) { Liquid::Template.parse("{% feed_meta posts %}").render!(context, {}) } |
| 334 | + let(:collection_feed) { Liquid::Template.parse("{% feed_meta collection %}").render!(context, {}) } |
| 335 | + let(:category_feed) { Liquid::Template.parse("{% feed_meta collection news %}").render!(context, {}) } |
| 336 | + |
| 337 | + it "renders the feed meta for the selected collection" do |
| 338 | + default_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed.xml" title="My awesome site" />' |
| 339 | + collection_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection.xml" title="My awesome site" />' |
| 340 | + category_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection/news.xml" title="My awesome site" />' |
| 341 | + expect(default_feed).to eql(default_feed_link) |
| 342 | + expect(collection_feed).to eql(collection_feed_link) |
| 343 | + expect(category_feed).to eql(category_feed_link) |
| 344 | + end |
| 345 | + end |
| 346 | + |
| 347 | + context "requesting all feed links" do |
| 348 | + let(:overrides) do |
| 349 | + { |
| 350 | + "collections" => { |
| 351 | + "collection" => { |
| 352 | + "output" => true, |
| 353 | + }, |
| 354 | + }, |
| 355 | + "feed" => { |
| 356 | + "collections" => { |
| 357 | + "collection" => { |
| 358 | + "categories" => ["news"], |
| 359 | + }, |
| 360 | + }, |
| 361 | + }, |
| 362 | + } |
| 363 | + end |
| 364 | + let(:full_feed_meta) { Liquid::Template.parse("{% feed_meta include: all %}").render!(context, {}) } |
| 365 | + |
| 366 | + it "renders the feed meta for all collections and categories" do |
| 367 | + default_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed.xml" title="My awesome site" />' |
| 368 | + collection_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection.xml" title="My awesome site" />' |
| 369 | + category_feed_link = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed/collection/news.xml" title="My awesome site" />' |
| 370 | + expect(full_feed_meta).to include(default_feed_link) |
| 371 | + expect(full_feed_meta).to include(collection_feed_link) |
| 372 | + expect(full_feed_meta).to include(category_feed_link) |
| 373 | + end |
| 374 | + end |
| 375 | + |
342 | 376 | context "feed stylesheet" do
|
343 | 377 | it "includes the stylesheet" do
|
344 | 378 | expect(contents).to include('<?xml-stylesheet type="text/xml" href="http://example.org/feed.xslt.xml"?>')
|
|
0 commit comments