feedjira 3.1.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/feed-parsing.md +15 -0
  3. data/.github/ISSUE_TEMPLATE/general-issue.md +8 -0
  4. data/.github/workflows/ruby.yml +39 -0
  5. data/.rubocop.yml +34 -615
  6. data/.rubocop_todo.yml +4 -29
  7. data/CHANGELOG.md +60 -13
  8. data/Gemfile +3 -4
  9. data/Rakefile +3 -1
  10. data/feedjira.gemspec +12 -12
  11. data/lib/feedjira/configuration.rb +5 -3
  12. data/lib/feedjira/core_ext/date.rb +3 -1
  13. data/lib/feedjira/core_ext/string.rb +2 -0
  14. data/lib/feedjira/core_ext/time.rb +3 -1
  15. data/lib/feedjira/core_ext.rb +2 -0
  16. data/lib/feedjira/date_time_utilities/date_time_epoch_parser.rb +3 -0
  17. data/lib/feedjira/date_time_utilities/date_time_language_parser.rb +5 -3
  18. data/lib/feedjira/date_time_utilities/date_time_pattern_parser.rb +9 -9
  19. data/lib/feedjira/date_time_utilities.rb +8 -8
  20. data/lib/feedjira/feed.rb +3 -1
  21. data/lib/feedjira/feed_entry_utilities.rb +5 -3
  22. data/lib/feedjira/feed_utilities.rb +8 -5
  23. data/lib/feedjira/parser/atom.rb +5 -6
  24. data/lib/feedjira/parser/atom_entry.rb +2 -0
  25. data/lib/feedjira/parser/atom_feed_burner.rb +4 -2
  26. data/lib/feedjira/parser/atom_feed_burner_entry.rb +2 -2
  27. data/lib/feedjira/parser/atom_google_alerts.rb +3 -1
  28. data/lib/feedjira/parser/atom_google_alerts_entry.rb +8 -5
  29. data/lib/feedjira/parser/atom_youtube.rb +4 -2
  30. data/lib/feedjira/parser/atom_youtube_entry.rb +2 -0
  31. data/lib/feedjira/parser/globally_unique_identifier.rb +2 -0
  32. data/lib/feedjira/parser/google_docs_atom.rb +5 -3
  33. data/lib/feedjira/parser/google_docs_atom_entry.rb +2 -0
  34. data/lib/feedjira/parser/itunes_rss.rb +4 -2
  35. data/lib/feedjira/parser/itunes_rss_category.rb +8 -6
  36. data/lib/feedjira/parser/itunes_rss_item.rb +3 -1
  37. data/lib/feedjira/parser/itunes_rss_owner.rb +2 -0
  38. data/lib/feedjira/parser/json_feed.rb +4 -2
  39. data/lib/feedjira/parser/json_feed_item.rb +7 -1
  40. data/lib/feedjira/parser/podlove_chapter.rb +5 -2
  41. data/lib/feedjira/parser/rss.rb +4 -1
  42. data/lib/feedjira/parser/rss_entry.rb +2 -0
  43. data/lib/feedjira/parser/rss_feed_burner.rb +4 -2
  44. data/lib/feedjira/parser/rss_feed_burner_entry.rb +2 -2
  45. data/lib/feedjira/parser/rss_image.rb +2 -0
  46. data/lib/feedjira/parser.rb +2 -0
  47. data/lib/feedjira/preprocessor.rb +3 -1
  48. data/lib/feedjira/rss_entry_utilities.rb +6 -2
  49. data/lib/feedjira/version.rb +3 -1
  50. data/lib/feedjira.rb +2 -1
  51. data/spec/feedjira/configuration_spec.rb +5 -3
  52. data/spec/feedjira/feed_spec.rb +13 -10
  53. data/spec/feedjira/{date_time_utilities_spec.rb → feed_utilities_date_time_spec.rb} +9 -7
  54. data/spec/feedjira/{feed_entry_utilities_spec.rb → feed_utilities_entry_spec.rb} +12 -10
  55. data/spec/feedjira/feed_utilities_spec.rb +37 -40
  56. data/spec/feedjira/parser/atom_entry_spec.rb +22 -20
  57. data/spec/feedjira/parser/atom_feed_burner_entry_spec.rb +16 -14
  58. data/spec/feedjira/parser/atom_feed_burner_spec.rb +30 -28
  59. data/spec/feedjira/parser/atom_google_alerts_entry_spec.rb +12 -10
  60. data/spec/feedjira/parser/atom_google_alerts_spec.rb +15 -13
  61. data/spec/feedjira/parser/atom_spec.rb +44 -25
  62. data/spec/feedjira/parser/atom_youtube_entry_spec.rb +25 -23
  63. data/spec/feedjira/parser/atom_youtube_spec.rb +16 -14
  64. data/spec/feedjira/parser/google_docs_atom_entry_spec.rb +5 -3
  65. data/spec/feedjira/parser/google_docs_atom_spec.rb +10 -8
  66. data/spec/feedjira/parser/{itunes_rss_item_spec.rb → i_tunes_rss_item_spec.rb} +21 -19
  67. data/spec/feedjira/parser/{itunes_rss_owner_spec.rb → i_tunes_rss_owner_spec.rb} +5 -3
  68. data/spec/feedjira/parser/itunes_rss_spec.rb +35 -33
  69. data/spec/feedjira/parser/json_feed_item_spec.rb +16 -14
  70. data/spec/feedjira/parser/json_feed_spec.rb +15 -13
  71. data/spec/feedjira/parser/podlove_chapter_spec.rb +9 -7
  72. data/spec/feedjira/parser/rss_entry_spec.rb +25 -23
  73. data/spec/feedjira/parser/rss_feed_burner_entry_spec.rb +24 -22
  74. data/spec/feedjira/parser/rss_feed_burner_spec.rb +20 -18
  75. data/spec/feedjira/parser/rss_spec.rb +26 -24
  76. data/spec/feedjira/preprocessor_spec.rb +6 -4
  77. data/spec/feedjira_spec.rb +50 -39
  78. data/spec/sample_feeds/a10.xml +72 -0
  79. data/spec/sample_feeds/atom_simple_single_entry.xml +17 -0
  80. data/spec/sample_feeds/atom_simple_single_entry_link_self.xml +17 -0
  81. data/spec/sample_feeds.rb +6 -1
  82. data/spec/spec_helper.rb +3 -7
  83. metadata +60 -24
  84. data/.travis.yml +0 -34
  85. data/Dangerfile +0 -1
@@ -1,119 +1,121 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
5
  module Feedjira
4
6
  module Parser
5
7
  describe "#will_parse?" do
6
- it "should return true for an itunes RSS feed" do
8
+ it "returns true for an itunes RSS feed" do
7
9
  expect(ITunesRSS).to be_able_to_parse(sample_itunes_feed)
8
10
  end
9
11
 
10
- it "should return true for an itunes RSS feed with spaces between attribute names, equals sign, and values" do # rubocop:disable Metrics/LineLength
12
+ it "returns true for an itunes RSS feed with spaces between attribute names, equals sign, and values" do
11
13
  expect(ITunesRSS).to be_able_to_parse(sample_itunes_feed_with_spaces)
12
14
  end
13
15
 
14
- it "should return true for an itunes RSS feed with single-quoted attributes" do # rubocop:disable Metrics/LineLength
15
- expect(ITunesRSS).to be_able_to_parse(sample_itunes_feed_with_single_quotes) # rubocop:disable Metrics/LineLength
16
+ it "returns true for an itunes RSS feed with single-quoted attributes" do
17
+ expect(ITunesRSS).to be_able_to_parse(sample_itunes_feed_with_single_quotes)
16
18
  end
17
19
 
18
- it "should return fase for an atom feed" do
19
- expect(ITunesRSS).to_not be_able_to_parse(sample_atom_feed)
20
+ it "returns fase for an atom feed" do
21
+ expect(ITunesRSS).not_to be_able_to_parse(sample_atom_feed)
20
22
  end
21
23
 
22
- it "should return false for an rss feedburner feed" do
23
- expect(ITunesRSS).to_not be_able_to_parse(sample_rss_feed_burner_feed)
24
+ it "returns false for an rss feedburner feed" do
25
+ expect(ITunesRSS).not_to be_able_to_parse(sample_rss_feed_burner_feed)
24
26
  end
25
27
  end
26
28
 
27
29
  describe "parsing" do
28
- before(:each) do
30
+ before do
29
31
  @feed = ITunesRSS.parse(sample_itunes_feed)
30
32
  end
31
33
 
32
- it "should parse the ttl" do
34
+ it "parses the ttl" do
33
35
  expect(@feed.ttl).to eq "60"
34
36
  end
35
37
 
36
- it "should parse the last build date" do
38
+ it "parses the last build date" do
37
39
  expect(@feed.last_built).to eq "Sat, 07 Sep 2002 09:42:31 GMT"
38
40
  end
39
41
 
40
- it "should parse the subtitle" do
42
+ it "parses the subtitle" do
41
43
  expect(@feed.itunes_subtitle).to eq "A show about everything"
42
44
  end
43
45
 
44
- it "should parse the author" do
46
+ it "parses the author" do
45
47
  expect(@feed.itunes_author).to eq "John Doe"
46
48
  end
47
49
 
48
- it "should parse an owner" do
50
+ it "parses an owner" do
49
51
  expect(@feed.itunes_owners.size).to eq 1
50
52
  end
51
53
 
52
- it "should parse an image" do
54
+ it "parses an image" do
53
55
  expect(@feed.itunes_image).to eq "http://example.com/podcasts/everything/AllAboutEverything.jpg"
54
56
  end
55
57
 
56
- it "should parse the image url" do
58
+ it "parses the image url" do
57
59
  expect(@feed.image.url).to eq "http://example.com/podcasts/everything/AllAboutEverything.jpg"
58
60
  end
59
61
 
60
- it "should parse the image title" do
62
+ it "parses the image title" do
61
63
  expect(@feed.image.title).to eq "All About Everything"
62
64
  end
63
65
 
64
- it "should parse the image link" do
66
+ it "parses the image link" do
65
67
  expect(@feed.image.link).to eq "http://www.example.com/podcasts/everything/index.html"
66
68
  end
67
69
 
68
- it "should parse the image width" do
70
+ it "parses the image width" do
69
71
  expect(@feed.image.width).to eq "88"
70
72
  end
71
73
 
72
- it "should parse the image height" do
74
+ it "parses the image height" do
73
75
  expect(@feed.image.height).to eq "31"
74
76
  end
75
77
 
76
- it "should parse the image description" do
77
- description = "All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Music Store" # rubocop:disable Metrics/LineLength
78
+ it "parses the image description" do
79
+ description = "All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Music Store"
78
80
  expect(@feed.image.description).to eq description
79
81
  end
80
82
 
81
- it "should parse categories" do
83
+ it "parses categories" do
82
84
  expect(@feed.itunes_categories).to eq [
83
85
  "Technology",
84
86
  "Gadgets",
85
87
  "TV & Film",
86
88
  "Arts",
87
89
  "Design",
88
- "Food",
90
+ "Food"
89
91
  ]
90
92
 
91
93
  expect(@feed.itunes_category_paths).to eq [
92
- %w(Technology Gadgets),
94
+ %w[Technology Gadgets],
93
95
  ["TV & Film"],
94
- %w(Arts Design),
95
- %w(Arts Food),
96
+ %w[Arts Design],
97
+ %w[Arts Food]
96
98
  ]
97
99
  end
98
100
 
99
- it "should parse the itunes type" do
101
+ it "parses the itunes type" do
100
102
  expect(@feed.itunes_type).to eq "episodic"
101
103
  end
102
104
 
103
- it "should parse the summary" do
104
- summary = "All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Music Store" # rubocop:disable Metrics/LineLength
105
+ it "parses the summary" do
106
+ summary = "All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Music Store"
105
107
  expect(@feed.itunes_summary).to eq summary
106
108
  end
107
109
 
108
- it "should parse the complete tag" do
110
+ it "parses the complete tag" do
109
111
  expect(@feed.itunes_complete).to eq "yes"
110
112
  end
111
113
 
112
- it "should parse entries" do
114
+ it "parses entries" do
113
115
  expect(@feed.entries.size).to eq 3
114
116
  end
115
117
 
116
- it "should parse the new-feed-url" do
118
+ it "parses the new-feed-url" do
117
119
  expect(@feed.itunes_new_feed_url).to eq "http://example.com/new.xml"
118
120
  end
119
121
  end
@@ -1,40 +1,42 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
5
  describe Feedjira::Parser::JSONFeedItem do
4
- before(:each) do
6
+ before do
5
7
  # I don't really like doing it this way because these unit test should only
6
8
  # rely on JSONFeed, but this is actually how it should work. You would
7
9
  # never just pass entry json straight to the JSONFeedItem
8
10
  @entry = Feedjira::Parser::JSONFeed.parse(sample_json_feed).entries.first
9
11
  end
10
12
 
11
- it "should parse the id" do
13
+ it "parses the id" do
12
14
  expect(@entry.id).to eq "http://inessential.com/2017/06/02/james_dempsey_and_the_breakpoints_benefi"
13
15
  end
14
16
 
15
- it "should parse the url" do
17
+ it "parses the url" do
16
18
  expect(@entry.url).to eq "http://inessential.com/2017/06/02/james_dempsey_and_the_breakpoints_benefi"
17
19
  end
18
20
 
19
- it "should parse the title" do
21
+ it "parses the title" do
20
22
  expect(@entry.title).to eq "James Dempsey and the Breakpoints Benefit App Camp for Girls"
21
23
  end
22
24
 
23
- it "should parse the content" do
24
- content = "<p>On Wednesday night I know where I’ll be — playing keyboard for a few songs at the James Dempsey and the Breakpoints concert benefitting App Camp for Girls.</p>\n\n<p><a href=\"https://www.classy.org/events/-/e126329\">You should get tickets</a>. It’s a fun time for a great cause.</p>\n\n<p>Bonus: James writes about how <a href=\"http://jamesdempsey.net/2017/06/02/wwdc-in-san-jose-full-circle/\">this concert is full circle for him</a>. It’s a special night.</p>" # rubocop:disable Metrics/LineLength
25
+ it "parses the content" do
26
+ content = "<p>On Wednesday night I know where I’ll be — playing keyboard for a few songs at the James Dempsey and the Breakpoints concert benefitting App Camp for Girls.</p>\n\n<p><a href=\"https://www.classy.org/events/-/e126329\">You should get tickets</a>. It’s a fun time for a great cause.</p>\n\n<p>Bonus: James writes about how <a href=\"http://jamesdempsey.net/2017/06/02/wwdc-in-san-jose-full-circle/\">this concert is full circle for him</a>. It’s a special night.</p>"
25
27
  expect(@entry.content).to eq content
26
28
  end
27
29
 
28
- it "should parse the published date" do
30
+ it "parses the published date" do
29
31
  published = Time.parse_safely "2017-06-02T22:05:47-07:00"
30
32
  expect(@entry.published).to eq published
31
33
  end
32
34
 
33
- it "should support each" do
35
+ it "supports each" do
34
36
  expect(@entry).to respond_to :each
35
37
  end
36
38
 
37
- it "should be able to list out all the fields with each" do
39
+ it "is able to list out all the fields with each" do
38
40
  all_fields = []
39
41
  title_value = ""
40
42
  @entry.each do |field, value|
@@ -44,7 +46,7 @@ describe Feedjira::Parser::JSONFeedItem do
44
46
 
45
47
  expect(title_value).to eq "James Dempsey and the Breakpoints Benefit App Camp for Girls"
46
48
 
47
- expected_fields = %w(
49
+ expected_fields = %w[
48
50
  author
49
51
  banner_image
50
52
  categories
@@ -58,21 +60,21 @@ describe Feedjira::Parser::JSONFeedItem do
58
60
  title
59
61
  updated
60
62
  url
61
- )
63
+ ]
62
64
  expect(all_fields).to match_array expected_fields
63
65
  end
64
66
 
65
- it "should support checking if a field exists in the entry" do
67
+ it "supports checking if a field exists in the entry" do
66
68
  expect(@entry).to include "title"
67
69
  expect(@entry).to include "url"
68
70
  end
69
71
 
70
- it "should allow access to fields with hash syntax" do
72
+ it "allows access to fields with hash syntax" do
71
73
  expect(@entry["title"]).to eq "James Dempsey and the Breakpoints Benefit App Camp for Girls"
72
74
  expect(@entry["url"]).to eq "http://inessential.com/2017/06/02/james_dempsey_and_the_breakpoints_benefi"
73
75
  end
74
76
 
75
- it "should allow setting field values with hash syntax" do
77
+ it "allows setting field values with hash syntax" do
76
78
  @entry["title"] = "Foobar"
77
79
  expect(@entry.title).to eq "Foobar"
78
80
  end
@@ -1,51 +1,53 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
5
  module Feedjira
4
6
  module Parser
5
7
  describe ".able_to_parse?" do
6
- it "should return true for a JSON feed" do
8
+ it "returns true for a JSON feed" do
7
9
  expect(JSONFeed).to be_able_to_parse(sample_json_feed)
8
10
  end
9
11
 
10
- it "should return false for an RSS feed" do
11
- expect(JSONFeed).to_not be_able_to_parse(sample_rss_feed)
12
+ it "returns false for an RSS feed" do
13
+ expect(JSONFeed).not_to be_able_to_parse(sample_rss_feed)
12
14
  end
13
15
 
14
- it "should return false for an Atom feed" do
15
- expect(JSONFeed).to_not be_able_to_parse(sample_atom_feed)
16
+ it "returns false for an Atom feed" do
17
+ expect(JSONFeed).not_to be_able_to_parse(sample_atom_feed)
16
18
  end
17
19
  end
18
20
 
19
21
  describe "parsing" do
20
- before(:each) do
22
+ before do
21
23
  @feed = JSONFeed.parse(sample_json_feed)
22
24
  end
23
25
 
24
- it "should parse the version" do
26
+ it "parses the version" do
25
27
  expect(@feed.version).to eq "https://jsonfeed.org/version/1"
26
28
  end
27
29
 
28
- it "should parse the title" do
30
+ it "parses the title" do
29
31
  expect(@feed.title).to eq "inessential.com"
30
32
  end
31
33
 
32
- it "should parse the url" do
34
+ it "parses the url" do
33
35
  expect(@feed.url).to eq "http://inessential.com/"
34
36
  end
35
37
 
36
- it "should parse the feed_url" do
38
+ it "parses the feed_url" do
37
39
  expect(@feed.feed_url).to eq "http://inessential.com/feed.json"
38
40
  end
39
41
 
40
- it "should parse the description" do
42
+ it "parses the description" do
41
43
  expect(@feed.description).to eq "Brent Simmons’s weblog."
42
44
  end
43
45
 
44
- it "should parse expired and return default (nil)" do
46
+ it "parses expired and return default (nil)" do
45
47
  expect(@feed.expired).to be nil
46
48
  end
47
49
 
48
- it "should parse entries" do
50
+ it "parses entries" do
49
51
  expect(@feed.entries.size).to eq 20
50
52
  end
51
53
  end
@@ -1,20 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
5
  describe Feedjira::Parser::PodloveChapter do
4
- before(:each) do
6
+ before do
5
7
  @item = Feedjira::Parser::ITunesRSS.parse(sample_podlove_feed).entries.first
6
8
  @chapter = @item.chapters.first
7
9
  end
8
10
 
9
- it "should parse chapters" do
11
+ it "parses chapters" do
10
12
  expect(@item.chapters.size).to eq 15
11
13
  end
12
14
 
13
- it "should sort chapters by time" do
15
+ it "sorts chapters by time" do
14
16
  expect(@item.chapters.last.title).to eq "Abschied"
15
17
  end
16
18
 
17
- it "should parse the start time" do
19
+ it "parses the start time" do
18
20
  expect(@chapter.start_ntp).to eq "00:00:26.407"
19
21
  expect(@chapter.start).to eq 26.407
20
22
  expect(@item.chapters[1].start).to eq 50
@@ -23,15 +25,15 @@ describe Feedjira::Parser::PodloveChapter do
23
25
  expect(@item.chapters.last.start).to eq 5700.034
24
26
  end
25
27
 
26
- it "should parse the title" do
28
+ it "parses the title" do
27
29
  expect(@chapter.title).to eq "Neil DeGrasse Tyson on Science"
28
30
  end
29
31
 
30
- it "should parse the link" do
32
+ it "parses the link" do
31
33
  expect(@chapter.url).to eq "https://example.com"
32
34
  end
33
35
 
34
- it "should parse the image" do
36
+ it "parses the image" do
35
37
  expect(@chapter.image).to eq "https://pics.example.com/pic.png"
36
38
  end
37
39
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
5
  describe Feedjira::Parser::RSSEntry do
4
- before(:each) do
6
+ before do
5
7
  # I don't really like doing it this way because these unit test should only
6
8
  # rely on RSSEntry, but this is actually how it should work. You would
7
9
  # never just pass entry xml straight to the AtomEnry
@@ -10,7 +12,7 @@ describe Feedjira::Parser::RSSEntry do
10
12
  Feedjira::Feed.add_common_feed_entry_element tag, as: :comment_rss
11
13
  end
12
14
 
13
- after(:each) do
15
+ after do
14
16
  # We change the title in one or more specs to test []=
15
17
  if @entry.title != "Nokogiri’s Slop Feature"
16
18
  feed = Feedjira::Parser::RSS.parse sample_rss_feed
@@ -18,45 +20,45 @@ describe Feedjira::Parser::RSSEntry do
18
20
  end
19
21
  end
20
22
 
21
- it "should parse the title" do
23
+ it "parses the title" do
22
24
  expect(@entry.title).to eq "Nokogiri’s Slop Feature"
23
25
  end
24
26
 
25
- it "should parse the url" do
27
+ it "parses the url" do
26
28
  expect(@entry.url).to eq "http://tenderlovemaking.com/2008/12/04/nokogiris-slop-feature/"
27
29
  end
28
30
 
29
- it "should parse the author" do
31
+ it "parses the author" do
30
32
  expect(@entry.author).to eq "Aaron Patterson"
31
33
  end
32
34
 
33
- it "should parse the content" do
35
+ it "parses the content" do
34
36
  expect(@entry.content).to eq sample_rss_entry_content
35
37
  end
36
38
 
37
- it "should provide a summary" do
38
- summary = "Oops! When I released nokogiri version 1.0.7, I totally forgot to talk about Nokogiri::Slop() feature that was added. Why is it called \"slop\"? It lets you sloppily explore documents. Basically, it decorates your document with method_missing() that allows you to search your document via method calls.\nGiven this document:\n\ndoc = Nokogiri::Slop&#40;&#60;&#60;-eohtml&#41;\n&#60;html&#62;\n&#160; &#60;body&#62;\n&#160; [...]" # rubocop:disable Metrics/LineLength
39
+ it "provides a summary" do
40
+ summary = "Oops! When I released nokogiri version 1.0.7, I totally forgot to talk about Nokogiri::Slop() feature that was added. Why is it called \"slop\"? It lets you sloppily explore documents. Basically, it decorates your document with method_missing() that allows you to search your document via method calls.\nGiven this document:\n\ndoc = Nokogiri::Slop&#40;&#60;&#60;-eohtml&#41;\n&#60;html&#62;\n&#160; &#60;body&#62;\n&#160; [...]"
39
41
  expect(@entry.summary).to eq summary
40
42
  end
41
43
 
42
- it "should parse the published date" do
44
+ it "parses the published date" do
43
45
  published = Time.parse_safely "Thu Dec 04 17:17:49 UTC 2008"
44
46
  expect(@entry.published).to eq published
45
47
  end
46
48
 
47
- it "should parse the categories" do
48
- expect(@entry.categories).to eq %w(computadora nokogiri rails)
49
+ it "parses the categories" do
50
+ expect(@entry.categories).to eq %w[computadora nokogiri rails]
49
51
  end
50
52
 
51
- it "should parse the guid as id" do
53
+ it "parses the guid as id" do
52
54
  expect(@entry.id).to eq "http://tenderlovemaking.com/?p=198"
53
55
  end
54
56
 
55
- it "should support each" do
57
+ it "supports each" do
56
58
  expect(@entry).to respond_to :each
57
59
  end
58
60
 
59
- it "should be able to list out all fields with each" do
61
+ it "is able to list out all fields with each" do
60
62
  all_fields = []
61
63
  title_value = ""
62
64
  @entry.each do |field, value|
@@ -66,7 +68,7 @@ describe Feedjira::Parser::RSSEntry do
66
68
 
67
69
  expect(title_value).to eq "Nokogiri’s Slop Feature"
68
70
 
69
- expected_fields = %w(
71
+ expected_fields = %w[
70
72
  author
71
73
  categories
72
74
  comment_rss
@@ -76,41 +78,41 @@ describe Feedjira::Parser::RSSEntry do
76
78
  summary
77
79
  title
78
80
  url
79
- )
81
+ ]
80
82
  expect(all_fields.sort).to eq expected_fields
81
83
  end
82
84
 
83
- it "should support checking if a field exists in the entry" do
85
+ it "supports checking if a field exists in the entry" do
84
86
  expect(@entry).to include "title"
85
87
  expect(@entry).to include "author"
86
88
  end
87
89
 
88
- it "should allow access to fields with hash syntax" do
90
+ it "allows access to fields with hash syntax" do
89
91
  expect(@entry["title"]).to eq "Nokogiri’s Slop Feature"
90
92
  expect(@entry["author"]).to eq "Aaron Patterson"
91
93
  end
92
94
 
93
- it "should allow setting field values with hash syntax" do
95
+ it "allows setting field values with hash syntax" do
94
96
  @entry["title"] = "Foobar"
95
97
  expect(@entry.title).to eq "Foobar"
96
98
  end
97
99
 
98
- it "should ignore urls from guids with isPermaLink='false'" do
100
+ it "ignores urls from guids with isPermaLink='false'" do
99
101
  feed = Feedjira.parse(sample_rss_feed_permalinks)
100
102
  expect(feed.entries[0].url).to eq nil
101
103
  end
102
104
 
103
- it "should get urls from guids with isPermaLink='true'" do
105
+ it "gets urls from guids with isPermaLink='true'" do
104
106
  feed = Feedjira.parse(sample_rss_feed_permalinks)
105
107
  expect(feed.entries[1].url).to eq "http://example.com/2"
106
108
  end
107
109
 
108
- it "should get urls from guid where isPermaLink is unspecified" do
110
+ it "gets urls from guid where isPermaLink is unspecified" do
109
111
  feed = Feedjira.parse(sample_rss_feed_permalinks)
110
112
  expect(feed.entries[2].url).to eq "http://example.com/3"
111
113
  end
112
114
 
113
- it "should prefer urls from <link> when both guid and link are specified" do
115
+ it "prefers urls from <link> when both guid and link are specified" do
114
116
  feed = Feedjira.parse(sample_rss_feed_permalinks)
115
117
  expect(feed.entries[3].url).to eq "http://example.com/4"
116
118
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
5
  describe Feedjira::Parser::RSSFeedBurnerEntry do
4
- before(:each) do
6
+ before do
5
7
  tag = "wfw:commentRss"
6
8
  Feedjira::Feed.add_common_feed_entry_element(tag, as: :comment_rss)
7
9
  # I don't really like doing it this way because these unit test should only
@@ -11,53 +13,53 @@ describe Feedjira::Parser::RSSFeedBurnerEntry do
11
13
  @entry = feed.entries.first
12
14
  end
13
15
 
14
- after(:each) do
16
+ after do
15
17
  # We change the title in one or more specs to test []=
16
- if @entry.title != "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M" # rubocop:disable Metrics/LineLength
18
+ if @entry.title != "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M"
17
19
  feed = Feedjira::Parser::RSS.parse sample_rss_feed_burner_feed
18
20
  @entry.title = feed.entries.first.title
19
21
  end
20
22
  end
21
23
 
22
- it "should parse the title" do
23
- title = "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M" # rubocop:disable Metrics/LineLength
24
+ it "parses the title" do
25
+ title = "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M"
24
26
  expect(@entry.title).to eq title
25
27
  end
26
28
 
27
- it "should parse the original url" do
28
- expect(@entry.url).to eq "http://techcrunch.com/2011/11/02/angies-list-prices-ipo-at-11-to-13-per-share-valued-at-over-600m/" # rubocop:disable Metrics/LineLength
29
+ it "parses the original url" do
30
+ expect(@entry.url).to eq "http://techcrunch.com/2011/11/02/angies-list-prices-ipo-at-11-to-13-per-share-valued-at-over-600m/"
29
31
  end
30
32
 
31
- it "should parse the author" do
33
+ it "parses the author" do
32
34
  expect(@entry.author).to eq "Leena Rao"
33
35
  end
34
36
 
35
- it "should parse the content" do
37
+ it "parses the content" do
36
38
  expect(@entry.content).to eq sample_rss_feed_burner_entry_content
37
39
  end
38
40
 
39
- it "should provide a summary" do
41
+ it "provides a summary" do
40
42
  expect(@entry.summary).to eq sample_rss_feed_burner_entry_description
41
43
  end
42
44
 
43
- it "should parse the published date" do
45
+ it "parses the published date" do
44
46
  published = Time.parse_safely "Wed Nov 02 17:25:27 UTC 2011"
45
47
  expect(@entry.published).to eq published
46
48
  end
47
49
 
48
- it "should parse the categories" do
50
+ it "parses the categories" do
49
51
  expect(@entry.categories).to eq ["TC", "angie\\'s list"]
50
52
  end
51
53
 
52
- it "should parse the guid as id" do
54
+ it "parses the guid as id" do
53
55
  expect(@entry.id).to eq "http://techcrunch.com/?p=446154"
54
56
  end
55
57
 
56
- it "should support each" do
58
+ it "supports each" do
57
59
  expect(@entry).to respond_to :each
58
60
  end
59
61
 
60
- it "should be able to list out all fields with each" do
62
+ it "is able to list out all fields with each" do
61
63
  all_fields = []
62
64
  title_value = ""
63
65
 
@@ -66,10 +68,10 @@ describe Feedjira::Parser::RSSFeedBurnerEntry do
66
68
  title_value = value if field == "title"
67
69
  end
68
70
 
69
- title = "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M" # rubocop:disable Metrics/LineLength
71
+ title = "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M"
70
72
  expect(title_value).to eq title
71
73
 
72
- expected_fields = %w(
74
+ expected_fields = %w[
73
75
  author
74
76
  categories
75
77
  comment_rss
@@ -80,22 +82,22 @@ describe Feedjira::Parser::RSSFeedBurnerEntry do
80
82
  summary
81
83
  title
82
84
  url
83
- )
85
+ ]
84
86
  expect(all_fields.sort).to eq expected_fields
85
87
  end
86
88
 
87
- it "should support checking if a field exists in the entry" do
89
+ it "supports checking if a field exists in the entry" do
88
90
  expect(@entry).to include "author"
89
91
  expect(@entry).to include "title"
90
92
  end
91
93
 
92
- it "should allow access to fields with hash syntax" do
94
+ it "allows access to fields with hash syntax" do
93
95
  expect(@entry["author"]).to eq "Leena Rao"
94
- title = "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M" # rubocop:disable Metrics/LineLength
96
+ title = "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M"
95
97
  expect(@entry["title"]).to eq title
96
98
  end
97
99
 
98
- it "should allow setting field values with hash syntax" do
100
+ it "allows setting field values with hash syntax" do
99
101
  @entry["title"] = "Foobar"
100
102
  expect(@entry.title).to eq "Foobar"
101
103
  end