docbrown/spec/services/feeds
Daniel Uber b4ce4ec975
15 minute fix: Shorten long titles from feed items if needed (#13961)
* Shorten long titles from feed items if needed

Fixes #13959

When the title is too long to create a valid article, put a shortened
title in the generated article markdown.

Added unit tests to cover the default case and the shortening case

* Fix Struct initialization

Rubocop suggested struct over openstruct because of performance, but
Struct.new creates a "class" with a positional initializer, while
Openstruct's new takes a hash like keyword set and builds an object
from those directly.

I mistakenly reused the openstruct syntax after the conversion. This
changes the feed and item to use Struct's initializer.

* Use String#truncate in place of custom trimming

`separator` enables a natural break (preventing space between last
character and ellipsis), and omission text "..." is the default behavior.

* Use verifying doubles in test, use method access to members in code

The instance_double for Feedjira::Parser::RSSEntry
necessitated changing hash key access to reader method access for the
data members (title, categories, summary, description).
2021-06-11 12:51:51 -05:00
..
assemble_article_markdown_spec.rb 15 minute fix: Shorten long titles from feed items if needed (#13961) 2021-06-11 12:51:51 -05:00
clean_html_spec.rb Move HtmlCleaner from app/labor into service (#11609) 2020-11-27 08:21:57 +07:00
import_spec.rb Auto-subscribe to comments on articles from feed (#13717) 2021-05-12 12:18:32 -04:00
validate_url_spec.rb Add missing features to new feed importer (#11501) 2020-11-24 18:11:13 +01:00