feedjira 3.0.0.beta1 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/ISSUE_TEMPLATE/feed-parsing.md +15 -0
- data/.github/workflows/ruby.yml +39 -0
- data/.rubocop.yml +18 -628
- data/.rubocop_todo.yml +11 -0
- data/CHANGELOG.md +66 -9
- data/Gemfile +4 -1
- data/README.md +10 -1
- data/Rakefile +3 -1
- data/feedjira.gemspec +14 -12
- data/lib/feedjira.rb +9 -3
- data/lib/feedjira/atom_entry_utilities.rb +51 -0
- data/lib/feedjira/configuration.rb +6 -3
- data/lib/feedjira/core_ext.rb +2 -0
- data/lib/feedjira/core_ext/date.rb +3 -2
- data/lib/feedjira/core_ext/string.rb +2 -1
- data/lib/feedjira/core_ext/time.rb +10 -10
- data/lib/feedjira/date_time_utilities.rb +8 -10
- data/lib/feedjira/date_time_utilities/date_time_epoch_parser.rb +3 -2
- data/lib/feedjira/date_time_utilities/date_time_language_parser.rb +4 -4
- data/lib/feedjira/date_time_utilities/date_time_pattern_parser.rb +9 -13
- data/lib/feedjira/feed.rb +3 -3
- data/lib/feedjira/feed_entry_utilities.rb +15 -8
- data/lib/feedjira/feed_utilities.rb +5 -4
- data/lib/feedjira/parser.rb +2 -0
- data/lib/feedjira/parser/atom.rb +5 -7
- data/lib/feedjira/parser/atom_entry.rb +4 -21
- data/lib/feedjira/parser/atom_feed_burner.rb +4 -3
- data/lib/feedjira/parser/atom_feed_burner_entry.rb +7 -18
- data/lib/feedjira/parser/atom_google_alerts.rb +26 -0
- data/lib/feedjira/parser/atom_google_alerts_entry.rb +21 -0
- data/lib/feedjira/parser/atom_youtube.rb +2 -1
- data/lib/feedjira/parser/atom_youtube_entry.rb +8 -7
- data/lib/feedjira/parser/globally_unique_identifier.rb +21 -0
- data/lib/feedjira/parser/google_docs_atom.rb +4 -4
- data/lib/feedjira/parser/google_docs_atom_entry.rb +3 -19
- data/lib/feedjira/parser/itunes_rss.rb +4 -3
- data/lib/feedjira/parser/itunes_rss_category.rb +6 -5
- data/lib/feedjira/parser/itunes_rss_item.rb +5 -8
- data/lib/feedjira/parser/itunes_rss_owner.rb +2 -1
- 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 -2
- data/lib/feedjira/parser/rss.rb +4 -2
- data/lib/feedjira/parser/rss_entry.rb +3 -28
- data/lib/feedjira/parser/rss_feed_burner.rb +3 -2
- data/lib/feedjira/parser/rss_feed_burner_entry.rb +6 -26
- data/lib/feedjira/parser/rss_image.rb +2 -0
- data/lib/feedjira/preprocessor.rb +3 -3
- data/lib/feedjira/rss_entry_utilities.rb +53 -0
- data/lib/feedjira/version.rb +3 -1
- data/spec/feedjira/configuration_spec.rb +5 -3
- 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 +3 -1
- data/spec/feedjira/feed_utilities_spec.rb +5 -3
- data/spec/feedjira/parser/atom_entry_spec.rb +7 -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 +34 -0
- data/spec/feedjira/parser/atom_google_alerts_spec.rb +62 -0
- data/spec/feedjira/parser/atom_spec.rb +30 -9
- data/spec/feedjira/parser/atom_youtube_entry_spec.rb +8 -6
- 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 +26 -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 +22 -1
- data/spec/sample_feeds.rb +7 -3
- data/spec/sample_feeds/InvalidDateFormat.xml +20 -0
- data/spec/sample_feeds/Permalinks.xml +22 -0
- data/spec/sample_feeds/a10.xml +72 -0
- data/spec/sample_feeds/atom_simple_single_entry.xml +17 -0
- data/spec/sample_feeds/atom_simple_single_entry_link_self.xml +17 -0
- data/spec/sample_feeds/google_alerts_atom.xml +1 -0
- data/spec/spec_helper.rb +3 -7
- metadata +44 -47
- data/.travis.yml +0 -37
- 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::FeedUtilities do
|
@@ -32,14 +34,14 @@ describe Feedjira::FeedUtilities do
|
|
32
34
|
end
|
33
35
|
|
34
36
|
it "should provide a sanitized title" do
|
35
|
-
new_title = "<script>this is not safe</script
|
37
|
+
new_title = "<script>this is not safe</script>#{@entry.title}"
|
36
38
|
@entry.title = new_title
|
37
39
|
scrubbed_title = Loofah.scrub_fragment(new_title, :prune).to_s
|
38
40
|
expect(@entry.title.sanitize).to eq scrubbed_title
|
39
41
|
end
|
40
42
|
|
41
43
|
it "should sanitize content in place" do
|
42
|
-
new_content = "<script
|
44
|
+
new_content = "<script>#{@entry.content}"
|
43
45
|
@entry.content = new_content.dup
|
44
46
|
|
45
47
|
scrubbed_content = Loofah.scrub_fragment(new_content, :prune).to_s
|
data/spec/feedjira/feed_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Feedjira::FeedUtilities do
|
@@ -73,13 +75,13 @@ describe Feedjira::FeedUtilities do
|
|
73
75
|
expect(feed.last_modified.class).to eq Time
|
74
76
|
end
|
75
77
|
|
76
|
-
it "should return new_entries? as true when entries are put into new_entries" do
|
78
|
+
it "should return new_entries? as true when entries are put into new_entries" do
|
77
79
|
feed = @klass.new
|
78
80
|
feed.new_entries << :foo
|
79
81
|
expect(feed.new_entries?).to eq true
|
80
82
|
end
|
81
83
|
|
82
|
-
it "should return a last_modified value from the entry with the most recent published date if the last_modified date hasn't been set" do
|
84
|
+
it "should return a last_modified value from the entry with the most recent published date if the last_modified date hasn't been set" do
|
83
85
|
feed = Feedjira::Parser::Atom.new
|
84
86
|
entry = Feedjira::Parser::AtomEntry.new
|
85
87
|
entry.published = Time.now.to_s
|
@@ -87,7 +89,7 @@ describe Feedjira::FeedUtilities do
|
|
87
89
|
expect(feed.last_modified).to eq entry.published
|
88
90
|
end
|
89
91
|
|
90
|
-
it "should not throw an error if one of the entries has published date of nil" do
|
92
|
+
it "should not throw an error if one of the entries has published date of nil" do
|
91
93
|
feed = Feedjira::Parser::Atom.new
|
92
94
|
entry = Feedjira::Parser::AtomEntry.new
|
93
95
|
entry.published = Time.now.to_s
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Feedjira::Parser::AtomEntry do
|
@@ -32,7 +34,7 @@ describe Feedjira::Parser::AtomEntry do
|
|
32
34
|
end
|
33
35
|
|
34
36
|
it "should provide a summary" do
|
35
|
-
summary = "Late last year an entrepreneur from Turkey visited me at Amazon HQ in Seattle. We talked about his plans to use AWS as part of his new social video portal startup. I won't spill any beans before he's ready to..."
|
37
|
+
summary = "Late last year an entrepreneur from Turkey visited me at Amazon HQ in Seattle. We talked about his plans to use AWS as part of his new social video portal startup. I won't spill any beans before he's ready to..."
|
36
38
|
expect(@entry.summary).to eq summary
|
37
39
|
end
|
38
40
|
|
@@ -42,7 +44,7 @@ describe Feedjira::Parser::AtomEntry do
|
|
42
44
|
end
|
43
45
|
|
44
46
|
it "should parse the categories" do
|
45
|
-
expect(@entry.categories).to eq %w
|
47
|
+
expect(@entry.categories).to eq %w[Turkey Seattle]
|
46
48
|
end
|
47
49
|
|
48
50
|
it "should parse the updated date" do
|
@@ -69,7 +71,7 @@ describe Feedjira::Parser::AtomEntry do
|
|
69
71
|
|
70
72
|
expect(title_value).to eq "AWS Job: Architect & Designer Position in Turkey"
|
71
73
|
|
72
|
-
expected_fields = %w
|
74
|
+
expected_fields = %w[
|
73
75
|
author
|
74
76
|
categories
|
75
77
|
content
|
@@ -78,9 +80,10 @@ describe Feedjira::Parser::AtomEntry do
|
|
78
80
|
published
|
79
81
|
summary
|
80
82
|
title
|
83
|
+
title_type
|
81
84
|
updated
|
82
85
|
url
|
83
|
-
|
86
|
+
]
|
84
87
|
expect(all_fields.sort).to eq expected_fields
|
85
88
|
end
|
86
89
|
|
@@ -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
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
describe Feedjira::Parser::AtomGoogleAlertsEntry do
|
6
|
+
before(:each) do
|
7
|
+
feed = Feedjira::Parser::AtomGoogleAlerts.parse sample_google_alerts_atom_feed
|
8
|
+
@entry = feed.entries.first
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should parse the title" do
|
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 ..."
|
14
|
+
expect(@entry.title_type).to eq "html"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should parse the url" do
|
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/"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should parse the content" do
|
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 ..."
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should parse the published date" do
|
26
|
+
published = Time.parse_safely "2019-07-10T11:53:37Z"
|
27
|
+
expect(@entry.published).to eq published
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should parse the updated date" do
|
31
|
+
updated = Time.parse_safely "2019-07-10T11:53:37Z"
|
32
|
+
expect(@entry.updated).to eq updated
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
module Feedjira
|
6
|
+
module Parser
|
7
|
+
describe "#able_to_parse?" do
|
8
|
+
it "should return true for a Google Alerts atom feed" do
|
9
|
+
expect(AtomGoogleAlerts).to be_able_to_parse(sample_google_alerts_atom_feed)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return false for an rdf feed" do
|
13
|
+
expect(AtomGoogleAlerts).to_not be_able_to_parse(sample_rdf_feed)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return false for a regular atom feed" do
|
17
|
+
expect(AtomGoogleAlerts).to_not be_able_to_parse(sample_atom_feed)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return false for a feedburner atom feed" do
|
21
|
+
expect(AtomGoogleAlerts).to_not be_able_to_parse(sample_feedburner_atom_feed)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "parsing" do
|
26
|
+
before(:each) do
|
27
|
+
@feed = AtomGoogleAlerts.parse(sample_google_alerts_atom_feed)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should parse the title" do
|
31
|
+
expect(@feed.title).to eq "Google Alert - Slack"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should parse the descripton" do
|
35
|
+
expect(@feed.description).to be_nil
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should parse the url" do
|
39
|
+
expect(@feed.url).to eq "https://www.google.com/alerts/feeds/04175468913983673025/4428013283581841004"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should parse the feed_url" do
|
43
|
+
expect(@feed.feed_url).to eq "https://www.google.com/alerts/feeds/04175468913983673025/4428013283581841004"
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should parse entries" do
|
47
|
+
expect(@feed.entries.size).to eq 20
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "preprocessing" do
|
52
|
+
it "retains markup in xhtml content" do
|
53
|
+
AtomGoogleAlerts.preprocess_xml = true
|
54
|
+
|
55
|
+
feed = AtomGoogleAlerts.parse sample_google_alerts_atom_feed
|
56
|
+
entry = feed.entries.first
|
57
|
+
|
58
|
+
expect(entry.content).to include("<b>Slack</b>")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -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,21 +32,26 @@ 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
|
|
39
|
+
it "should parse the icon url" do
|
40
|
+
feed_with_icon = Atom.parse(load_sample("SamRuby.xml"))
|
41
|
+
expect(feed_with_icon.icon).to eq "../favicon.ico"
|
42
|
+
end
|
43
|
+
|
37
44
|
it "should parse the url" do
|
38
45
|
expect(@feed.url).to eq "http://aws.typepad.com/aws/"
|
39
46
|
end
|
40
47
|
|
41
|
-
it "should parse the url even when it doesn't have the type='text/html' attribute" do
|
48
|
+
it "should parse the url even when it doesn't have the type='text/html' attribute" do
|
42
49
|
xml = load_sample "atom_with_link_tag_for_url_unmarked.xml"
|
43
50
|
feed = Atom.parse xml
|
44
51
|
expect(feed.url).to eq "http://www.innoq.com/planet/"
|
45
52
|
end
|
46
53
|
|
47
|
-
it "should parse the feed_url even when it doesn't have the type='application/atom+xml' attribute" do
|
54
|
+
it "should parse the feed_url even when it doesn't have the type='application/atom+xml' attribute" do
|
48
55
|
feed = Atom.parse(load_sample("atom_with_link_tag_for_url_unmarked.xml"))
|
49
56
|
expect(feed.feed_url).to eq "http://www.innoq.com/planet/atom.xml"
|
50
57
|
end
|
@@ -75,9 +82,11 @@ module Feedjira
|
|
75
82
|
feed = Atom.parse sample_atom_xhtml_feed
|
76
83
|
entry = feed.entries.first
|
77
84
|
|
78
|
-
expect(entry.
|
79
|
-
expect(entry.
|
80
|
-
expect(entry.
|
85
|
+
expect(entry.raw_title).to match(/<i/)
|
86
|
+
expect(entry.title).to eq("Sentry Calming Collar for dogs")
|
87
|
+
expect(entry.title_type).to eq("xhtml")
|
88
|
+
expect(entry.summary).to match(/<b/)
|
89
|
+
expect(entry.content).to match(/\A<p/)
|
81
90
|
end
|
82
91
|
|
83
92
|
it "should not duplicate content when there are divs in content" do
|
@@ -89,7 +98,7 @@ module Feedjira
|
|
89
98
|
end
|
90
99
|
end
|
91
100
|
|
92
|
-
describe "parsing url and
|
101
|
+
describe "parsing url and feed_url" do
|
93
102
|
before :each do
|
94
103
|
@feed = Atom.parse(sample_atom_middleman_feed)
|
95
104
|
end
|
@@ -98,9 +107,21 @@ module Feedjira
|
|
98
107
|
expect(@feed.url).to eq "http://feedjira.com/blog"
|
99
108
|
end
|
100
109
|
|
101
|
-
it "should parse
|
110
|
+
it "should parse feed_url" do
|
102
111
|
expect(@feed.feed_url).to eq "http://feedjira.com/blog/feed.xml"
|
103
112
|
end
|
113
|
+
|
114
|
+
it "should not parse links without the rel='self' attribute as feed_url" do
|
115
|
+
xml = load_sample "atom_simple_single_entry.xml"
|
116
|
+
feed = Atom.parse xml
|
117
|
+
expect(feed.feed_url).to be_nil
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should not parse links with the rel='self' attribute as url" do
|
121
|
+
xml = load_sample "atom_simple_single_entry_link_self.xml"
|
122
|
+
feed = Atom.parse xml
|
123
|
+
expect(feed.url).to be_nil
|
124
|
+
end
|
104
125
|
end
|
105
126
|
end
|
106
127
|
end
|
@@ -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
|
@@ -20,15 +22,15 @@ describe Feedjira::Parser::AtomYoutubeEntry do
|
|
20
22
|
end
|
21
23
|
|
22
24
|
it "should have the published date" do
|
23
|
-
expect(@entry.published).to eq Time.parse_safely("2015-05-04T00:01:27+00:00")
|
25
|
+
expect(@entry.published).to eq Time.parse_safely("2015-05-04T00:01:27+00:00")
|
24
26
|
end
|
25
27
|
|
26
28
|
it "should have the updated date" do
|
27
|
-
expect(@entry.updated).to eq Time.parse_safely("2015-05-13T17:38:30+00:00")
|
29
|
+
expect(@entry.updated).to eq Time.parse_safely("2015-05-13T17:38:30+00:00")
|
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
|
|