feedjira 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/general-issue.md +8 -0
  3. data/.github/workflows/ruby.yml +1 -1
  4. data/.rubocop.yml +33 -1
  5. data/CHANGELOG.md +13 -0
  6. data/Gemfile +0 -3
  7. data/README.md +1 -2
  8. data/feedjira.gemspec +7 -3
  9. data/lib/feedjira/core_ext/date.rb +3 -2
  10. data/lib/feedjira/core_ext/time.rb +1 -1
  11. data/lib/feedjira/date_time_utilities/date_time_language_parser.rb +1 -1
  12. data/lib/feedjira/feed_utilities.rb +3 -3
  13. data/lib/feedjira/parser/atom_feed_burner.rb +1 -1
  14. data/lib/feedjira/parser/atom_google_alerts_entry.rb +2 -0
  15. data/lib/feedjira/parser/atom_youtube.rb +2 -2
  16. data/lib/feedjira/parser/google_docs_atom.rb +1 -1
  17. data/lib/feedjira/parser/itunes_rss_category.rb +2 -2
  18. data/lib/feedjira/parser/podlove_chapter.rb +2 -2
  19. data/lib/feedjira/parser/rss.rb +1 -1
  20. data/lib/feedjira/parser/rss_feed_burner.rb +2 -2
  21. data/lib/feedjira/rss_entry_utilities.rb +5 -1
  22. data/lib/feedjira/version.rb +1 -1
  23. data/lib/feedjira.rb +2 -2
  24. data/spec/feedjira/feed_spec.rb +11 -10
  25. data/spec/feedjira/{date_time_utilities_spec.rb → feed_utilities_date_time_spec.rb} +8 -8
  26. data/spec/feedjira/{feed_entry_utilities_spec.rb → feed_utilities_entry_spec.rb} +9 -9
  27. data/spec/feedjira/feed_utilities_spec.rb +37 -42
  28. data/spec/feedjira/parser/atom_entry_spec.rb +16 -16
  29. data/spec/feedjira/parser/atom_feed_burner_entry_spec.rb +10 -10
  30. data/spec/feedjira/parser/atom_feed_burner_spec.rb +26 -26
  31. data/spec/feedjira/parser/atom_google_alerts_entry_spec.rb +6 -6
  32. data/spec/feedjira/parser/atom_google_alerts_spec.rb +13 -13
  33. data/spec/feedjira/parser/atom_spec.rb +23 -23
  34. data/spec/feedjira/parser/atom_youtube_entry_spec.rb +19 -19
  35. data/spec/feedjira/parser/atom_youtube_spec.rb +13 -13
  36. data/spec/feedjira/parser/google_docs_atom_entry_spec.rb +3 -3
  37. data/spec/feedjira/parser/google_docs_atom_spec.rb +8 -8
  38. data/spec/feedjira/parser/{itunes_rss_item_spec.rb → i_tunes_rss_item_spec.rb} +18 -18
  39. data/spec/feedjira/parser/{itunes_rss_owner_spec.rb → i_tunes_rss_owner_spec.rb} +3 -3
  40. data/spec/feedjira/parser/itunes_rss_spec.rb +26 -26
  41. data/spec/feedjira/parser/json_feed_item_spec.rb +11 -11
  42. data/spec/feedjira/parser/json_feed_spec.rb +14 -14
  43. data/spec/feedjira/parser/podlove_chapter_spec.rb +7 -7
  44. data/spec/feedjira/parser/rss_entry_spec.rb +26 -20
  45. data/spec/feedjira/parser/rss_feed_burner_entry_spec.rb +16 -15
  46. data/spec/feedjira/parser/rss_feed_burner_spec.rb +17 -17
  47. data/spec/feedjira/parser/rss_spec.rb +25 -25
  48. data/spec/feedjira/preprocessor_spec.rb +3 -3
  49. data/spec/feedjira_spec.rb +41 -41
  50. data/spec/sample_feeds/RSSWithComments.xml +277 -0
  51. data/spec/sample_feeds.rb +2 -1
  52. metadata +68 -77
@@ -3,40 +3,40 @@
3
3
  require "spec_helper"
4
4
 
5
5
  describe Feedjira::Parser::JSONFeedItem do
6
- before(:each) do
6
+ before do
7
7
  # I don't really like doing it this way because these unit test should only
8
8
  # rely on JSONFeed, but this is actually how it should work. You would
9
9
  # never just pass entry json straight to the JSONFeedItem
10
10
  @entry = Feedjira::Parser::JSONFeed.parse(sample_json_feed).entries.first
11
11
  end
12
12
 
13
- it "should parse the id" do
13
+ it "parses the id" do
14
14
  expect(@entry.id).to eq "http://inessential.com/2017/06/02/james_dempsey_and_the_breakpoints_benefi"
15
15
  end
16
16
 
17
- it "should parse the url" do
17
+ it "parses the url" do
18
18
  expect(@entry.url).to eq "http://inessential.com/2017/06/02/james_dempsey_and_the_breakpoints_benefi"
19
19
  end
20
20
 
21
- it "should parse the title" do
21
+ it "parses the title" do
22
22
  expect(@entry.title).to eq "James Dempsey and the Breakpoints Benefit App Camp for Girls"
23
23
  end
24
24
 
25
- it "should parse the content" do
25
+ it "parses the content" do
26
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>"
27
27
  expect(@entry.content).to eq content
28
28
  end
29
29
 
30
- it "should parse the published date" do
30
+ it "parses the published date" do
31
31
  published = Time.parse_safely "2017-06-02T22:05:47-07:00"
32
32
  expect(@entry.published).to eq published
33
33
  end
34
34
 
35
- it "should support each" do
35
+ it "supports each" do
36
36
  expect(@entry).to respond_to :each
37
37
  end
38
38
 
39
- 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
40
40
  all_fields = []
41
41
  title_value = ""
42
42
  @entry.each do |field, value|
@@ -64,17 +64,17 @@ describe Feedjira::Parser::JSONFeedItem do
64
64
  expect(all_fields).to match_array expected_fields
65
65
  end
66
66
 
67
- it "should support checking if a field exists in the entry" do
67
+ it "supports checking if a field exists in the entry" do
68
68
  expect(@entry).to include "title"
69
69
  expect(@entry).to include "url"
70
70
  end
71
71
 
72
- it "should allow access to fields with hash syntax" do
72
+ it "allows access to fields with hash syntax" do
73
73
  expect(@entry["title"]).to eq "James Dempsey and the Breakpoints Benefit App Camp for Girls"
74
74
  expect(@entry["url"]).to eq "http://inessential.com/2017/06/02/james_dempsey_and_the_breakpoints_benefi"
75
75
  end
76
76
 
77
- it "should allow setting field values with hash syntax" do
77
+ it "allows setting field values with hash syntax" do
78
78
  @entry["title"] = "Foobar"
79
79
  expect(@entry.title).to eq "Foobar"
80
80
  end
@@ -5,49 +5,49 @@ require "spec_helper"
5
5
  module Feedjira
6
6
  module Parser
7
7
  describe ".able_to_parse?" do
8
- it "should return true for a JSON feed" do
8
+ it "returns true for a JSON feed" do
9
9
  expect(JSONFeed).to be_able_to_parse(sample_json_feed)
10
10
  end
11
11
 
12
- it "should return false for an RSS feed" do
13
- 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)
14
14
  end
15
15
 
16
- it "should return false for an Atom feed" do
17
- 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)
18
18
  end
19
19
  end
20
20
 
21
21
  describe "parsing" do
22
- before(:each) do
22
+ before do
23
23
  @feed = JSONFeed.parse(sample_json_feed)
24
24
  end
25
25
 
26
- it "should parse the version" do
26
+ it "parses the version" do
27
27
  expect(@feed.version).to eq "https://jsonfeed.org/version/1"
28
28
  end
29
29
 
30
- it "should parse the title" do
30
+ it "parses the title" do
31
31
  expect(@feed.title).to eq "inessential.com"
32
32
  end
33
33
 
34
- it "should parse the url" do
34
+ it "parses the url" do
35
35
  expect(@feed.url).to eq "http://inessential.com/"
36
36
  end
37
37
 
38
- it "should parse the feed_url" do
38
+ it "parses the feed_url" do
39
39
  expect(@feed.feed_url).to eq "http://inessential.com/feed.json"
40
40
  end
41
41
 
42
- it "should parse the description" do
42
+ it "parses the description" do
43
43
  expect(@feed.description).to eq "Brent Simmons’s weblog."
44
44
  end
45
45
 
46
- it "should parse expired and return default (nil)" do
47
- expect(@feed.expired).to be nil
46
+ it "parses expired and return default (nil)" do
47
+ expect(@feed.expired).to be_nil
48
48
  end
49
49
 
50
- it "should parse entries" do
50
+ it "parses entries" do
51
51
  expect(@feed.entries.size).to eq 20
52
52
  end
53
53
  end
@@ -3,20 +3,20 @@
3
3
  require "spec_helper"
4
4
 
5
5
  describe Feedjira::Parser::PodloveChapter do
6
- before(:each) do
6
+ before do
7
7
  @item = Feedjira::Parser::ITunesRSS.parse(sample_podlove_feed).entries.first
8
8
  @chapter = @item.chapters.first
9
9
  end
10
10
 
11
- it "should parse chapters" do
11
+ it "parses chapters" do
12
12
  expect(@item.chapters.size).to eq 15
13
13
  end
14
14
 
15
- it "should sort chapters by time" do
15
+ it "sorts chapters by time" do
16
16
  expect(@item.chapters.last.title).to eq "Abschied"
17
17
  end
18
18
 
19
- it "should parse the start time" do
19
+ it "parses the start time" do
20
20
  expect(@chapter.start_ntp).to eq "00:00:26.407"
21
21
  expect(@chapter.start).to eq 26.407
22
22
  expect(@item.chapters[1].start).to eq 50
@@ -25,15 +25,15 @@ describe Feedjira::Parser::PodloveChapter do
25
25
  expect(@item.chapters.last.start).to eq 5700.034
26
26
  end
27
27
 
28
- it "should parse the title" do
28
+ it "parses the title" do
29
29
  expect(@chapter.title).to eq "Neil DeGrasse Tyson on Science"
30
30
  end
31
31
 
32
- it "should parse the link" do
32
+ it "parses the link" do
33
33
  expect(@chapter.url).to eq "https://example.com"
34
34
  end
35
35
 
36
- it "should parse the image" do
36
+ it "parses the image" do
37
37
  expect(@chapter.image).to eq "https://pics.example.com/pic.png"
38
38
  end
39
39
  end
@@ -3,7 +3,7 @@
3
3
  require "spec_helper"
4
4
 
5
5
  describe Feedjira::Parser::RSSEntry do
6
- before(:each) do
6
+ before do
7
7
  # I don't really like doing it this way because these unit test should only
8
8
  # rely on RSSEntry, but this is actually how it should work. You would
9
9
  # never just pass entry xml straight to the AtomEnry
@@ -12,7 +12,7 @@ describe Feedjira::Parser::RSSEntry do
12
12
  Feedjira::Feed.add_common_feed_entry_element tag, as: :comment_rss
13
13
  end
14
14
 
15
- after(:each) do
15
+ after do
16
16
  # We change the title in one or more specs to test []=
17
17
  if @entry.title != "Nokogiri’s Slop Feature"
18
18
  feed = Feedjira::Parser::RSS.parse sample_rss_feed
@@ -20,45 +20,45 @@ describe Feedjira::Parser::RSSEntry do
20
20
  end
21
21
  end
22
22
 
23
- it "should parse the title" do
23
+ it "parses the title" do
24
24
  expect(@entry.title).to eq "Nokogiri’s Slop Feature"
25
25
  end
26
26
 
27
- it "should parse the url" do
27
+ it "parses the url" do
28
28
  expect(@entry.url).to eq "http://tenderlovemaking.com/2008/12/04/nokogiris-slop-feature/"
29
29
  end
30
30
 
31
- it "should parse the author" do
31
+ it "parses the author" do
32
32
  expect(@entry.author).to eq "Aaron Patterson"
33
33
  end
34
34
 
35
- it "should parse the content" do
35
+ it "parses the content" do
36
36
  expect(@entry.content).to eq sample_rss_entry_content
37
37
  end
38
38
 
39
- it "should provide a summary" do
39
+ it "provides a summary" do
40
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; [...]"
41
41
  expect(@entry.summary).to eq summary
42
42
  end
43
43
 
44
- it "should parse the published date" do
44
+ it "parses the published date" do
45
45
  published = Time.parse_safely "Thu Dec 04 17:17:49 UTC 2008"
46
46
  expect(@entry.published).to eq published
47
47
  end
48
48
 
49
- it "should parse the categories" do
49
+ it "parses the categories" do
50
50
  expect(@entry.categories).to eq %w[computadora nokogiri rails]
51
51
  end
52
52
 
53
- it "should parse the guid as id" do
53
+ it "parses the guid as id" do
54
54
  expect(@entry.id).to eq "http://tenderlovemaking.com/?p=198"
55
55
  end
56
56
 
57
- it "should support each" do
57
+ it "supports each" do
58
58
  expect(@entry).to respond_to :each
59
59
  end
60
60
 
61
- it "should be able to list out all fields with each" do
61
+ it "is able to list out all fields with each" do
62
62
  all_fields = []
63
63
  title_value = ""
64
64
  @entry.each do |field, value|
@@ -72,6 +72,7 @@ describe Feedjira::Parser::RSSEntry do
72
72
  author
73
73
  categories
74
74
  comment_rss
75
+ comments
75
76
  content
76
77
  entry_id
77
78
  published
@@ -82,38 +83,43 @@ describe Feedjira::Parser::RSSEntry do
82
83
  expect(all_fields.sort).to eq expected_fields
83
84
  end
84
85
 
85
- it "should support checking if a field exists in the entry" do
86
+ it "supports checking if a field exists in the entry" do
86
87
  expect(@entry).to include "title"
87
88
  expect(@entry).to include "author"
88
89
  end
89
90
 
90
- it "should allow access to fields with hash syntax" do
91
+ it "allows access to fields with hash syntax" do
91
92
  expect(@entry["title"]).to eq "Nokogiri’s Slop Feature"
92
93
  expect(@entry["author"]).to eq "Aaron Patterson"
93
94
  end
94
95
 
95
- it "should allow setting field values with hash syntax" do
96
+ it "allows setting field values with hash syntax" do
96
97
  @entry["title"] = "Foobar"
97
98
  expect(@entry.title).to eq "Foobar"
98
99
  end
99
100
 
100
- it "should ignore urls from guids with isPermaLink='false'" do
101
+ it "ignores urls from guids with isPermaLink='false'" do
101
102
  feed = Feedjira.parse(sample_rss_feed_permalinks)
102
- expect(feed.entries[0].url).to eq nil
103
+ expect(feed.entries[0].url).to be_nil
103
104
  end
104
105
 
105
- it "should get urls from guids with isPermaLink='true'" do
106
+ it "gets urls from guids with isPermaLink='true'" do
106
107
  feed = Feedjira.parse(sample_rss_feed_permalinks)
107
108
  expect(feed.entries[1].url).to eq "http://example.com/2"
108
109
  end
109
110
 
110
- it "should get urls from guid where isPermaLink is unspecified" do
111
+ it "gets urls from guid where isPermaLink is unspecified" do
111
112
  feed = Feedjira.parse(sample_rss_feed_permalinks)
112
113
  expect(feed.entries[2].url).to eq "http://example.com/3"
113
114
  end
114
115
 
115
- it "should prefer urls from <link> when both guid and link are specified" do
116
+ it "prefers urls from <link> when both guid and link are specified" do
116
117
  feed = Feedjira.parse(sample_rss_feed_permalinks)
117
118
  expect(feed.entries[3].url).to eq "http://example.com/4"
118
119
  end
120
+
121
+ it "exposes comments URL" do
122
+ feed = Feedjira.parse(sample_rss_feed_with_comments)
123
+ expect(feed.entries[0].comments).to eq "https://news.ycombinator.com/item?id=30937433"
124
+ end
119
125
  end
@@ -3,7 +3,7 @@
3
3
  require "spec_helper"
4
4
 
5
5
  describe Feedjira::Parser::RSSFeedBurnerEntry do
6
- before(:each) do
6
+ before do
7
7
  tag = "wfw:commentRss"
8
8
  Feedjira::Feed.add_common_feed_entry_element(tag, as: :comment_rss)
9
9
  # I don't really like doing it this way because these unit test should only
@@ -13,7 +13,7 @@ describe Feedjira::Parser::RSSFeedBurnerEntry do
13
13
  @entry = feed.entries.first
14
14
  end
15
15
 
16
- after(:each) do
16
+ after do
17
17
  # We change the title in one or more specs to test []=
18
18
  if @entry.title != "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M"
19
19
  feed = Feedjira::Parser::RSS.parse sample_rss_feed_burner_feed
@@ -21,45 +21,45 @@ describe Feedjira::Parser::RSSFeedBurnerEntry do
21
21
  end
22
22
  end
23
23
 
24
- it "should parse the title" do
24
+ it "parses the title" do
25
25
  title = "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M"
26
26
  expect(@entry.title).to eq title
27
27
  end
28
28
 
29
- it "should parse the original url" do
29
+ it "parses the original url" do
30
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/"
31
31
  end
32
32
 
33
- it "should parse the author" do
33
+ it "parses the author" do
34
34
  expect(@entry.author).to eq "Leena Rao"
35
35
  end
36
36
 
37
- it "should parse the content" do
37
+ it "parses the content" do
38
38
  expect(@entry.content).to eq sample_rss_feed_burner_entry_content
39
39
  end
40
40
 
41
- it "should provide a summary" do
41
+ it "provides a summary" do
42
42
  expect(@entry.summary).to eq sample_rss_feed_burner_entry_description
43
43
  end
44
44
 
45
- it "should parse the published date" do
45
+ it "parses the published date" do
46
46
  published = Time.parse_safely "Wed Nov 02 17:25:27 UTC 2011"
47
47
  expect(@entry.published).to eq published
48
48
  end
49
49
 
50
- it "should parse the categories" do
50
+ it "parses the categories" do
51
51
  expect(@entry.categories).to eq ["TC", "angie\\'s list"]
52
52
  end
53
53
 
54
- it "should parse the guid as id" do
54
+ it "parses the guid as id" do
55
55
  expect(@entry.id).to eq "http://techcrunch.com/?p=446154"
56
56
  end
57
57
 
58
- it "should support each" do
58
+ it "supports each" do
59
59
  expect(@entry).to respond_to :each
60
60
  end
61
61
 
62
- it "should be able to list out all fields with each" do
62
+ it "is able to list out all fields with each" do
63
63
  all_fields = []
64
64
  title_value = ""
65
65
 
@@ -75,6 +75,7 @@ describe Feedjira::Parser::RSSFeedBurnerEntry do
75
75
  author
76
76
  categories
77
77
  comment_rss
78
+ comments
78
79
  content
79
80
  entry_id
80
81
  image
@@ -86,18 +87,18 @@ describe Feedjira::Parser::RSSFeedBurnerEntry do
86
87
  expect(all_fields.sort).to eq expected_fields
87
88
  end
88
89
 
89
- it "should support checking if a field exists in the entry" do
90
+ it "supports checking if a field exists in the entry" do
90
91
  expect(@entry).to include "author"
91
92
  expect(@entry).to include "title"
92
93
  end
93
94
 
94
- it "should allow access to fields with hash syntax" do
95
+ it "allows access to fields with hash syntax" do
95
96
  expect(@entry["author"]).to eq "Leena Rao"
96
97
  title = "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M"
97
98
  expect(@entry["title"]).to eq title
98
99
  end
99
100
 
100
- it "should allow setting field values with hash syntax" do
101
+ it "allows setting field values with hash syntax" do
101
102
  @entry["title"] = "Foobar"
102
103
  expect(@entry.title).to eq "Foobar"
103
104
  end
@@ -5,60 +5,60 @@ require "spec_helper"
5
5
  module Feedjira
6
6
  module Parser
7
7
  describe "#will_parse?" do
8
- it "should return true for a feedburner rss feed" do
8
+ it "returns true for a feedburner rss feed" do
9
9
  expect(RSSFeedBurner).to be_able_to_parse sample_rss_feed_burner_feed
10
10
  end
11
11
 
12
- it "should return false for a regular RSS feed" do
13
- expect(RSSFeedBurner).to_not be_able_to_parse sample_rss_feed
12
+ it "returns false for a regular RSS feed" do
13
+ expect(RSSFeedBurner).not_to be_able_to_parse sample_rss_feed
14
14
  end
15
15
 
16
- it "should return false for a feedburner atom feed" do
17
- expect(RSSFeedBurner).to_not be_able_to_parse sample_feedburner_atom_feed
16
+ it "returns false for a feedburner atom feed" do
17
+ expect(RSSFeedBurner).not_to be_able_to_parse sample_feedburner_atom_feed
18
18
  end
19
19
 
20
- it "should return false for an rdf feed" do
21
- expect(RSSFeedBurner).to_not be_able_to_parse sample_rdf_feed
20
+ it "returns false for an rdf feed" do
21
+ expect(RSSFeedBurner).not_to be_able_to_parse sample_rdf_feed
22
22
  end
23
23
 
24
- it "should return false for a regular atom feed" do
25
- expect(RSSFeedBurner).to_not be_able_to_parse sample_atom_feed
24
+ it "returns false for a regular atom feed" do
25
+ expect(RSSFeedBurner).not_to be_able_to_parse sample_atom_feed
26
26
  end
27
27
  end
28
28
 
29
29
  describe "parsing" do
30
- before(:each) do
30
+ before do
31
31
  @feed = RSSFeedBurner.parse(sample_rss_feed_burner_feed)
32
32
  end
33
33
 
34
- it "should parse the title" do
34
+ it "parses the title" do
35
35
  expect(@feed.title).to eq "TechCrunch"
36
36
  end
37
37
 
38
- it "should parse the description" do
38
+ it "parses the description" do
39
39
  description = "TechCrunch is a group-edited blog that profiles the companies, products and events defining and transforming the new web."
40
40
  expect(@feed.description).to eq description
41
41
  end
42
42
 
43
- it "should parse the url" do
43
+ it "parses the url" do
44
44
  expect(@feed.url).to eq "http://techcrunch.com"
45
45
  end
46
46
 
47
- it "should parse the last build date" do
47
+ it "parses the last build date" do
48
48
  expect(@feed.last_built).to eq "Wed, 02 Nov 2011 17:29:59 +0000"
49
49
  end
50
50
 
51
- it "should parse the hub urls" do
51
+ it "parses the hub urls" do
52
52
  expect(@feed.hubs.count).to eq 2
53
53
  expect(@feed.hubs.first).to eq "http://pubsubhubbub.appspot.com/"
54
54
  end
55
55
 
56
- it "should provide an accessor for the feed_url" do
56
+ it "provides an accessor for the feed_url" do
57
57
  expect(@feed).to respond_to :feed_url
58
58
  expect(@feed).to respond_to :feed_url=
59
59
  end
60
60
 
61
- it "should parse entries" do
61
+ it "parses entries" do
62
62
  expect(@feed.entries.size).to eq 20
63
63
  end
64
64
  end
@@ -4,88 +4,88 @@ require "spec_helper"
4
4
 
5
5
  describe Feedjira::Parser::RSS do
6
6
  describe "#will_parse?" do
7
- it "should return true for an RSS feed" do
8
- expect(Feedjira::Parser::RSS).to be_able_to_parse(sample_rss_feed)
7
+ it "returns true for an RSS feed" do
8
+ expect(described_class).to be_able_to_parse(sample_rss_feed)
9
9
  end
10
10
 
11
- it "should return false for an atom feed" do
12
- expect(Feedjira::Parser::RSS).to_not be_able_to_parse(sample_atom_feed)
11
+ it "returns false for an atom feed" do
12
+ expect(described_class).not_to be_able_to_parse(sample_atom_feed)
13
13
  end
14
14
 
15
- it "should return false for an rss feedburner feed" do
16
- able = Feedjira::Parser::RSS.able_to_parse? sample_rss_feed_burner_feed
17
- expect(able).to eq false
15
+ it "returns false for an rss feedburner feed" do
16
+ able = described_class.able_to_parse? sample_rss_feed_burner_feed
17
+ expect(able).to be false
18
18
  end
19
19
  end
20
20
 
21
21
  describe "parsing" do
22
- before(:each) do
23
- @feed = Feedjira::Parser::RSS.parse(sample_rss_feed)
22
+ before do
23
+ @feed = described_class.parse(sample_rss_feed)
24
24
  end
25
25
 
26
- it "should parse the version" do
26
+ it "parses the version" do
27
27
  expect(@feed.version).to eq "2.0"
28
28
  end
29
29
 
30
- it "should parse the title" do
30
+ it "parses the title" do
31
31
  expect(@feed.title).to eq "Tender Lovemaking"
32
32
  end
33
33
 
34
- it "should parse the description" do
34
+ it "parses the description" do
35
35
  expect(@feed.description).to eq "The act of making love, tenderly."
36
36
  end
37
37
 
38
- it "should parse the url" do
38
+ it "parses the url" do
39
39
  expect(@feed.url).to eq "http://tenderlovemaking.com"
40
40
  end
41
41
 
42
- it "should parse the ttl" do
42
+ it "parses the ttl" do
43
43
  expect(@feed.ttl).to eq "60"
44
44
  end
45
45
 
46
- it "should parse the last build date" do
46
+ it "parses the last build date" do
47
47
  expect(@feed.last_built).to eq "Sat, 07 Sep 2002 09:42:31 GMT"
48
48
  end
49
49
 
50
- it "should parse the hub urls" do
50
+ it "parses the hub urls" do
51
51
  expect(@feed.hubs.count).to eq 1
52
52
  expect(@feed.hubs.first).to eq "http://pubsubhubbub.appspot.com/"
53
53
  end
54
54
 
55
- it "should provide an accessor for the feed_url" do
55
+ it "provides an accessor for the feed_url" do
56
56
  expect(@feed).to respond_to :feed_url
57
57
  expect(@feed).to respond_to :feed_url=
58
58
  end
59
59
 
60
- it "should parse the language" do
60
+ it "parses the language" do
61
61
  expect(@feed.language).to eq "en"
62
62
  end
63
63
 
64
- it "should parse the image url" do
64
+ it "parses the image url" do
65
65
  expect(@feed.image.url).to eq "https://tenderlovemaking.com/images/header-logo-text-trimmed.png"
66
66
  end
67
67
 
68
- it "should parse the image title" do
68
+ it "parses the image title" do
69
69
  expect(@feed.image.title).to eq "Tender Lovemaking"
70
70
  end
71
71
 
72
- it "should parse the image link" do
72
+ it "parses the image link" do
73
73
  expect(@feed.image.link).to eq "http://tenderlovemaking.com"
74
74
  end
75
75
 
76
- it "should parse the image width" do
76
+ it "parses the image width" do
77
77
  expect(@feed.image.width).to eq "766"
78
78
  end
79
79
 
80
- it "should parse the image height" do
80
+ it "parses the image height" do
81
81
  expect(@feed.image.height).to eq "138"
82
82
  end
83
83
 
84
- it "should parse the image description" do
84
+ it "parses the image description" do
85
85
  expect(@feed.image.description).to eq "The act of making love, tenderly."
86
86
  end
87
87
 
88
- it "should parse entries" do
88
+ it "parses entries" do
89
89
  expect(@feed.entries.size).to eq 10
90
90
  end
91
91
  end
@@ -6,14 +6,14 @@ describe Feedjira::Preprocessor do
6
6
  it "returns the xml as parsed by Nokogiri" do
7
7
  xml = "<xml></xml>"
8
8
  doc = Nokogiri::XML(xml).remove_namespaces!
9
- processor = Feedjira::Preprocessor.new xml
9
+ processor = described_class.new xml
10
10
  escaped = processor.to_xml
11
11
 
12
12
  expect(escaped).to eq doc.to_xml
13
13
  end
14
14
 
15
15
  it "escapes markup in xhtml content" do
16
- processor = Feedjira::Preprocessor.new sample_atom_xhtml_feed
16
+ processor = described_class.new sample_atom_xhtml_feed
17
17
  escaped = processor.to_xml
18
18
  escaped_parts = escaped.split "\n"
19
19
 
@@ -23,7 +23,7 @@ describe Feedjira::Preprocessor do
23
23
  end
24
24
 
25
25
  it "leaves escaped html within pre tag" do
26
- processor = Feedjira::Preprocessor.new(sample_atom_xhtml_with_escpaed_html_in_pre_tag_feed)
26
+ processor = described_class.new(sample_atom_xhtml_with_escpaed_html_in_pre_tag_feed)
27
27
  escaped = processor.to_xml
28
28
  expected_pre_tag = " &lt;pre&gt;&amp;lt;b&amp;gt;test&amp;lt;b&amp;gt;&lt;/pre&gt;"
29
29
  expect(escaped.split("\n")[7]).to eq(expected_pre_tag)