feedjira 3.1.1 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/feed-parsing.md +15 -0
- data/.rubocop.yml +19 -627
- data/.rubocop_todo.yml +4 -29
- data/.travis.yml +0 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -2
- data/Rakefile +3 -1
- data/feedjira.gemspec +6 -10
- data/lib/feedjira.rb +4 -3
- data/lib/feedjira/configuration.rb +5 -3
- data/lib/feedjira/core_ext.rb +2 -0
- data/lib/feedjira/core_ext/date.rb +3 -1
- data/lib/feedjira/core_ext/string.rb +2 -0
- data/lib/feedjira/core_ext/time.rb +2 -0
- data/lib/feedjira/date_time_utilities.rb +8 -8
- data/lib/feedjira/date_time_utilities/date_time_epoch_parser.rb +3 -0
- data/lib/feedjira/date_time_utilities/date_time_language_parser.rb +4 -2
- data/lib/feedjira/date_time_utilities/date_time_pattern_parser.rb +9 -9
- data/lib/feedjira/feed.rb +2 -0
- data/lib/feedjira/feed_entry_utilities.rb +5 -3
- data/lib/feedjira/feed_utilities.rb +5 -2
- data/lib/feedjira/parser.rb +2 -0
- data/lib/feedjira/parser/atom.rb +3 -1
- data/lib/feedjira/parser/atom_entry.rb +2 -0
- data/lib/feedjira/parser/atom_feed_burner.rb +4 -2
- data/lib/feedjira/parser/atom_feed_burner_entry.rb +2 -2
- data/lib/feedjira/parser/atom_google_alerts.rb +3 -1
- data/lib/feedjira/parser/atom_google_alerts_entry.rb +6 -5
- data/lib/feedjira/parser/atom_youtube.rb +2 -0
- data/lib/feedjira/parser/atom_youtube_entry.rb +2 -0
- data/lib/feedjira/parser/globally_unique_identifier.rb +2 -0
- data/lib/feedjira/parser/google_docs_atom.rb +4 -2
- data/lib/feedjira/parser/google_docs_atom_entry.rb +2 -0
- data/lib/feedjira/parser/itunes_rss.rb +4 -2
- data/lib/feedjira/parser/itunes_rss_category.rb +2 -0
- data/lib/feedjira/parser/itunes_rss_item.rb +3 -1
- data/lib/feedjira/parser/itunes_rss_owner.rb +2 -0
- data/lib/feedjira/parser/json_feed.rb +4 -2
- data/lib/feedjira/parser/json_feed_item.rb +7 -1
- data/lib/feedjira/parser/podlove_chapter.rb +3 -0
- data/lib/feedjira/parser/rss.rb +4 -1
- data/lib/feedjira/parser/rss_entry.rb +2 -0
- data/lib/feedjira/parser/rss_feed_burner.rb +3 -1
- data/lib/feedjira/parser/rss_feed_burner_entry.rb +2 -2
- data/lib/feedjira/parser/rss_image.rb +2 -0
- data/lib/feedjira/preprocessor.rb +3 -1
- data/lib/feedjira/rss_entry_utilities.rb +6 -2
- data/lib/feedjira/version.rb +3 -1
- data/spec/feedjira/configuration_spec.rb +2 -0
- data/spec/feedjira/date_time_utilities_spec.rb +2 -0
- data/spec/feedjira/feed_entry_utilities_spec.rb +4 -2
- data/spec/feedjira/feed_spec.rb +2 -0
- data/spec/feedjira/feed_utilities_spec.rb +5 -3
- data/spec/feedjira/parser/atom_entry_spec.rb +6 -4
- data/spec/feedjira/parser/atom_feed_burner_entry_spec.rb +7 -5
- data/spec/feedjira/parser/atom_feed_burner_spec.rb +4 -2
- data/spec/feedjira/parser/atom_google_alerts_entry_spec.rb +6 -4
- data/spec/feedjira/parser/atom_google_alerts_spec.rb +2 -0
- data/spec/feedjira/parser/atom_spec.rb +9 -7
- data/spec/feedjira/parser/atom_youtube_entry_spec.rb +6 -4
- data/spec/feedjira/parser/atom_youtube_spec.rb +6 -4
- data/spec/feedjira/parser/google_docs_atom_entry_spec.rb +2 -0
- data/spec/feedjira/parser/google_docs_atom_spec.rb +2 -0
- data/spec/feedjira/parser/itunes_rss_item_spec.rb +3 -1
- data/spec/feedjira/parser/itunes_rss_owner_spec.rb +2 -0
- data/spec/feedjira/parser/itunes_rss_spec.rb +11 -9
- data/spec/feedjira/parser/json_feed_item_spec.rb +5 -3
- data/spec/feedjira/parser/json_feed_spec.rb +2 -0
- data/spec/feedjira/parser/podlove_chapter_spec.rb +2 -0
- data/spec/feedjira/parser/rss_entry_spec.rb +6 -4
- data/spec/feedjira/parser/rss_feed_burner_entry_spec.rb +9 -7
- data/spec/feedjira/parser/rss_feed_burner_spec.rb +3 -1
- data/spec/feedjira/parser/rss_spec.rb +2 -0
- data/spec/feedjira/preprocessor_spec.rb +4 -2
- data/spec/feedjira_spec.rb +11 -0
- data/spec/sample_feeds.rb +4 -1
- data/spec/sample_feeds/a10.xml +72 -0
- data/spec/spec_helper.rb +3 -1
- metadata +13 -25
- data/Dangerfile +0 -1
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Feedjira::Parser::AtomFeedBurnerEntry do
|
@@ -14,10 +16,10 @@ describe Feedjira::Parser::AtomFeedBurnerEntry do
|
|
14
16
|
expect(@entry.title).to eq "Making a Ruby C library even faster"
|
15
17
|
end
|
16
18
|
|
17
|
-
it "should be able to fetch a url via the 'alternate' rel if no origLink exists" do
|
18
|
-
xml = File.read("#{File.dirname(__FILE__)}/../../sample_feeds/PaulDixExplainsNothingAlternate.xml")
|
19
|
+
it "should be able to fetch a url via the 'alternate' rel if no origLink exists" do
|
20
|
+
xml = File.read("#{File.dirname(__FILE__)}/../../sample_feeds/PaulDixExplainsNothingAlternate.xml")
|
19
21
|
entry = Feedjira::Parser::AtomFeedBurner.parse(xml).entries.first
|
20
|
-
expect(entry.url).to eq("http://feeds.feedburner.com/~r/PaulDixExplainsNothing/~3/519925023/making-a-ruby-c-library-even-faster.html")
|
22
|
+
expect(entry.url).to eq("http://feeds.feedburner.com/~r/PaulDixExplainsNothing/~3/519925023/making-a-ruby-c-library-even-faster.html")
|
21
23
|
end
|
22
24
|
|
23
25
|
it "should parse the url" do
|
@@ -25,7 +27,7 @@ describe Feedjira::Parser::AtomFeedBurnerEntry do
|
|
25
27
|
end
|
26
28
|
|
27
29
|
it "should parse the url when there is no alternate" do
|
28
|
-
xml = File.read("#{File.dirname(__FILE__)}/../../sample_feeds/FeedBurnerUrlNoAlternate.xml")
|
30
|
+
xml = File.read("#{File.dirname(__FILE__)}/../../sample_feeds/FeedBurnerUrlNoAlternate.xml")
|
29
31
|
entry = Feedjira::Parser::AtomFeedBurner.parse(xml).entries.first
|
30
32
|
expect(entry.url).to eq "http://example.com/QQQQ.html"
|
31
33
|
end
|
@@ -39,7 +41,7 @@ describe Feedjira::Parser::AtomFeedBurnerEntry do
|
|
39
41
|
end
|
40
42
|
|
41
43
|
it "should provide a summary" do
|
42
|
-
summary = "Last week I released the first version of a SAX based XML parsing library called SAX-Machine. It uses Nokogiri, which uses libxml, so it's pretty fast. However, I felt that it could be even faster. The only question was how..."
|
44
|
+
summary = "Last week I released the first version of a SAX based XML parsing library called SAX-Machine. It uses Nokogiri, which uses libxml, so it's pretty fast. However, I felt that it could be even faster. The only question was how..."
|
43
45
|
expect(@entry.summary).to eq summary
|
44
46
|
end
|
45
47
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
module Feedjira
|
@@ -30,7 +32,7 @@ module Feedjira
|
|
30
32
|
end
|
31
33
|
|
32
34
|
it "should parse the description" do
|
33
|
-
description = "Entrepreneurship, programming, software development, politics, NYC, and random thoughts."
|
35
|
+
description = "Entrepreneurship, programming, software development, politics, NYC, and random thoughts."
|
34
36
|
expect(@feed.description).to eq description
|
35
37
|
end
|
36
38
|
|
@@ -119,7 +121,7 @@ module Feedjira
|
|
119
121
|
feed = AtomFeedBurner.parse sample_feed_burner_atom_xhtml_feed
|
120
122
|
entry = feed.entries.first
|
121
123
|
|
122
|
-
expect(entry.content).to match(/\A
|
124
|
+
expect(entry.content).to match(/\A<p/)
|
123
125
|
end
|
124
126
|
end
|
125
127
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Feedjira::Parser::AtomGoogleAlertsEntry do
|
@@ -7,17 +9,17 @@ describe Feedjira::Parser::AtomGoogleAlertsEntry do
|
|
7
9
|
end
|
8
10
|
|
9
11
|
it "should parse the title" do
|
10
|
-
expect(@entry.title).to eq "Report offers Prediction of Automotive Slack Market by Top key players like Haldex, Meritor, Bendix ..."
|
11
|
-
expect(@entry.raw_title).to eq "Report offers Prediction of Automotive <b>Slack</b> Market by Top key players like Haldex, Meritor, Bendix ..."
|
12
|
+
expect(@entry.title).to eq "Report offers Prediction of Automotive Slack Market by Top key players like Haldex, Meritor, Bendix ..."
|
13
|
+
expect(@entry.raw_title).to eq "Report offers Prediction of Automotive <b>Slack</b> Market by Top key players like Haldex, Meritor, Bendix ..."
|
12
14
|
expect(@entry.title_type).to eq "html"
|
13
15
|
end
|
14
16
|
|
15
17
|
it "should parse the url" do
|
16
|
-
expect(@entry.url).to eq "https://www.aglobalmarketresearch.com/report-offers-prediction-of-automotive-slack-market-by-top-key-players-like-haldex-meritor-bendix-mei-wabco-accuride-stemco-tbk-febi-aydinsan/"
|
18
|
+
expect(@entry.url).to eq "https://www.aglobalmarketresearch.com/report-offers-prediction-of-automotive-slack-market-by-top-key-players-like-haldex-meritor-bendix-mei-wabco-accuride-stemco-tbk-febi-aydinsan/"
|
17
19
|
end
|
18
20
|
|
19
21
|
it "should parse the content" do
|
20
|
-
expect(@entry.content).to eq "Automotive <b>Slack</b> Market reports provides a comprehensive overview of the global market size and share. It provides strategists, marketers and senior ..."
|
22
|
+
expect(@entry.content).to eq "Automotive <b>Slack</b> Market reports provides a comprehensive overview of the global market size and share. It provides strategists, marketers and senior ..."
|
21
23
|
end
|
22
24
|
|
23
25
|
it "should parse the published date" do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
module Feedjira
|
@@ -15,7 +17,7 @@ module Feedjira
|
|
15
17
|
expect(Atom).to_not be_able_to_parse(sample_rss_feed_burner_feed)
|
16
18
|
end
|
17
19
|
|
18
|
-
it "should return true for an atom feed that has line breaks in between attributes in the <feed> node" do
|
20
|
+
it "should return true for an atom feed that has line breaks in between attributes in the <feed> node" do
|
19
21
|
expect(Atom).to be_able_to_parse(sample_atom_feed_line_breaks)
|
20
22
|
end
|
21
23
|
end
|
@@ -30,7 +32,7 @@ module Feedjira
|
|
30
32
|
end
|
31
33
|
|
32
34
|
it "should parse the description" do
|
33
|
-
description = "Amazon Web Services, Products, Tools, and Developer Information..."
|
35
|
+
description = "Amazon Web Services, Products, Tools, and Developer Information..."
|
34
36
|
expect(@feed.description).to eq description
|
35
37
|
end
|
36
38
|
|
@@ -38,13 +40,13 @@ module Feedjira
|
|
38
40
|
expect(@feed.url).to eq "http://aws.typepad.com/aws/"
|
39
41
|
end
|
40
42
|
|
41
|
-
it "should parse the url even when it doesn't have the type='text/html' attribute" do
|
43
|
+
it "should parse the url even when it doesn't have the type='text/html' attribute" do
|
42
44
|
xml = load_sample "atom_with_link_tag_for_url_unmarked.xml"
|
43
45
|
feed = Atom.parse xml
|
44
46
|
expect(feed.url).to eq "http://www.innoq.com/planet/"
|
45
47
|
end
|
46
48
|
|
47
|
-
it "should parse the feed_url even when it doesn't have the type='application/atom+xml' attribute" do
|
49
|
+
it "should parse the feed_url even when it doesn't have the type='application/atom+xml' attribute" do
|
48
50
|
feed = Atom.parse(load_sample("atom_with_link_tag_for_url_unmarked.xml"))
|
49
51
|
expect(feed.feed_url).to eq "http://www.innoq.com/planet/atom.xml"
|
50
52
|
end
|
@@ -75,11 +77,11 @@ module Feedjira
|
|
75
77
|
feed = Atom.parse sample_atom_xhtml_feed
|
76
78
|
entry = feed.entries.first
|
77
79
|
|
78
|
-
expect(entry.raw_title).to match(
|
80
|
+
expect(entry.raw_title).to match(/<i/)
|
79
81
|
expect(entry.title).to eq("Sentry Calming Collar for dogs")
|
80
82
|
expect(entry.title_type).to eq("xhtml")
|
81
|
-
expect(entry.summary).to match(
|
82
|
-
expect(entry.content).to match(/\A
|
83
|
+
expect(entry.summary).to match(/<b/)
|
84
|
+
expect(entry.content).to match(/\A<p/)
|
83
85
|
end
|
84
86
|
|
85
87
|
it "should not duplicate content when there are divs in content" do
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
|
2
4
|
|
3
5
|
describe Feedjira::Parser::AtomYoutubeEntry do
|
4
6
|
describe "parsing" do
|
@@ -28,7 +30,7 @@ describe Feedjira::Parser::AtomYoutubeEntry do
|
|
28
30
|
end
|
29
31
|
|
30
32
|
it "should have the content populated from the media:description element" do
|
31
|
-
expect(@entry.content).to eq "A question is the most powerful force in the world. It can start you on an adventure or spark a connection. See where a question can take you. The Google app is available on iOS and Android. Download the app here: http://www.google.com/search/about/download"
|
33
|
+
expect(@entry.content).to eq "A question is the most powerful force in the world. It can start you on an adventure or spark a connection. See where a question can take you. The Google app is available on iOS and Android. Download the app here: http://www.google.com/search/about/download"
|
32
34
|
end
|
33
35
|
|
34
36
|
it "should have the summary but blank" do
|
@@ -44,7 +46,7 @@ describe Feedjira::Parser::AtomYoutubeEntry do
|
|
44
46
|
end
|
45
47
|
|
46
48
|
it "should have the custom media url" do
|
47
|
-
expect(@entry.media_url).to eq "https://www.youtube.com/v/5shykyfmb28?version=3"
|
49
|
+
expect(@entry.media_url).to eq "https://www.youtube.com/v/5shykyfmb28?version=3"
|
48
50
|
end
|
49
51
|
|
50
52
|
it "should have the custom media type" do
|
@@ -60,7 +62,7 @@ describe Feedjira::Parser::AtomYoutubeEntry do
|
|
60
62
|
end
|
61
63
|
|
62
64
|
it "should have the custom media thumbnail url" do
|
63
|
-
expect(@entry.media_thumbnail_url).to eq "https://i2.ytimg.com/vi/5shykyfmb28/hqdefault.jpg"
|
65
|
+
expect(@entry.media_thumbnail_url).to eq "https://i2.ytimg.com/vi/5shykyfmb28/hqdefault.jpg"
|
64
66
|
end
|
65
67
|
|
66
68
|
it "should have the custom media thumbnail width" do
|
@@ -1,17 +1,19 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
|
2
4
|
|
3
5
|
describe Feedjira::Parser::AtomYoutube do
|
4
6
|
describe "#will_parse?" do
|
5
7
|
it "should return true for an atom youtube feed" do
|
6
|
-
expect(Feedjira::Parser::AtomYoutube).to be_able_to_parse(sample_youtube_atom_feed)
|
8
|
+
expect(Feedjira::Parser::AtomYoutube).to be_able_to_parse(sample_youtube_atom_feed)
|
7
9
|
end
|
8
10
|
|
9
11
|
it "should return fase for an atom feed" do
|
10
|
-
expect(Feedjira::Parser::AtomYoutube).to_not be_able_to_parse(sample_atom_feed)
|
12
|
+
expect(Feedjira::Parser::AtomYoutube).to_not be_able_to_parse(sample_atom_feed)
|
11
13
|
end
|
12
14
|
|
13
15
|
it "should return false for an rss feedburner feed" do
|
14
|
-
expect(Feedjira::Parser::AtomYoutube).to_not be_able_to_parse(sample_rss_feed_burner_feed)
|
16
|
+
expect(Feedjira::Parser::AtomYoutube).to_not be_able_to_parse(sample_rss_feed_burner_feed)
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Feedjira::Parser::ITunesRSSItem do
|
@@ -25,7 +27,7 @@ describe Feedjira::Parser::ITunesRSSItem do
|
|
25
27
|
end
|
26
28
|
|
27
29
|
it "should parse the summary" do
|
28
|
-
summary = "This week we talk about salt and pepper shakers, comparing and contrasting pour rates, construction materials, and overall aesthetics. Come and join the party!"
|
30
|
+
summary = "This week we talk about salt and pepper shakers, comparing and contrasting pour rates, construction materials, and overall aesthetics. Come and join the party!"
|
29
31
|
expect(@item.itunes_summary).to eq summary
|
30
32
|
end
|
31
33
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
module Feedjira
|
@@ -7,12 +9,12 @@ module Feedjira
|
|
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
|
12
|
+
it "should return 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
|
15
|
-
expect(ITunesRSS).to be_able_to_parse(sample_itunes_feed_with_single_quotes)
|
16
|
+
it "should return 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
20
|
it "should return fase for an atom feed" do
|
@@ -74,7 +76,7 @@ module Feedjira
|
|
74
76
|
end
|
75
77
|
|
76
78
|
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"
|
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
|
|
@@ -85,14 +87,14 @@ module Feedjira
|
|
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
|
94
|
+
%w[Technology Gadgets],
|
93
95
|
["TV & Film"],
|
94
|
-
%w
|
95
|
-
%w
|
96
|
+
%w[Arts Design],
|
97
|
+
%w[Arts Food]
|
96
98
|
]
|
97
99
|
end
|
98
100
|
|
@@ -101,7 +103,7 @@ module Feedjira
|
|
101
103
|
end
|
102
104
|
|
103
105
|
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"
|
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
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Feedjira::Parser::JSONFeedItem do
|
@@ -21,7 +23,7 @@ describe Feedjira::Parser::JSONFeedItem do
|
|
21
23
|
end
|
22
24
|
|
23
25
|
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>"
|
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
|
|
@@ -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,7 +60,7 @@ 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
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Feedjira::Parser::RSSEntry do
|
@@ -35,7 +37,7 @@ describe Feedjira::Parser::RSSEntry do
|
|
35
37
|
end
|
36
38
|
|
37
39
|
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(<<-eohtml)\n<html>\n  <body>\n  [...]"
|
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(<<-eohtml)\n<html>\n  <body>\n  [...]"
|
39
41
|
expect(@entry.summary).to eq summary
|
40
42
|
end
|
41
43
|
|
@@ -45,7 +47,7 @@ describe Feedjira::Parser::RSSEntry do
|
|
45
47
|
end
|
46
48
|
|
47
49
|
it "should parse the categories" do
|
48
|
-
expect(@entry.categories).to eq %w
|
50
|
+
expect(@entry.categories).to eq %w[computadora nokogiri rails]
|
49
51
|
end
|
50
52
|
|
51
53
|
it "should parse the guid as id" do
|
@@ -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,7 +78,7 @@ 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
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Feedjira::Parser::RSSFeedBurnerEntry do
|
@@ -13,19 +15,19 @@ describe Feedjira::Parser::RSSFeedBurnerEntry do
|
|
13
15
|
|
14
16
|
after(:each) 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"
|
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
24
|
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"
|
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
29
|
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/"
|
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
33
|
it "should parse the author" do
|
@@ -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"
|
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,7 +82,7 @@ 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
|
|
@@ -91,7 +93,7 @@ describe Feedjira::Parser::RSSFeedBurnerEntry do
|
|
91
93
|
|
92
94
|
it "should allow 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"
|
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
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
module Feedjira
|
@@ -34,7 +36,7 @@ module Feedjira
|
|
34
36
|
end
|
35
37
|
|
36
38
|
it "should parse the description" do
|
37
|
-
description = "TechCrunch is a group-edited blog that profiles the companies, products and events defining and transforming the new web."
|
39
|
+
description = "TechCrunch is a group-edited blog that profiles the companies, products and events defining and transforming the new web."
|
38
40
|
expect(@feed.description).to eq description
|
39
41
|
end
|
40
42
|
|