feedjira 3.2.0 → 3.2.1
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/general-issue.md +8 -0
- data/.rubocop.yml +32 -0
- data/Gemfile +0 -3
- data/feedjira.gemspec +6 -1
- data/lib/feedjira/core_ext/date.rb +1 -1
- data/lib/feedjira/core_ext/time.rb +1 -1
- data/lib/feedjira/date_time_utilities/date_time_language_parser.rb +1 -1
- data/lib/feedjira/feed_utilities.rb +3 -3
- data/lib/feedjira/parser/atom_feed_burner.rb +1 -1
- data/lib/feedjira/parser/atom_google_alerts_entry.rb +2 -0
- data/lib/feedjira/parser/atom_youtube.rb +2 -2
- data/lib/feedjira/parser/google_docs_atom.rb +1 -1
- data/lib/feedjira/parser/itunes_rss_category.rb +2 -2
- data/lib/feedjira/parser/podlove_chapter.rb +2 -2
- data/lib/feedjira/parser/rss.rb +1 -1
- data/lib/feedjira/parser/rss_feed_burner.rb +2 -2
- data/lib/feedjira/version.rb +1 -1
- data/lib/feedjira.rb +2 -2
- data/spec/feedjira/feed_spec.rb +11 -10
- data/spec/feedjira/{date_time_utilities_spec.rb → feed_utilities_date_time_spec.rb} +7 -7
- data/spec/feedjira/{feed_entry_utilities_spec.rb → feed_utilities_entry_spec.rb} +8 -8
- data/spec/feedjira/feed_utilities_spec.rb +35 -40
- data/spec/feedjira/parser/atom_entry_spec.rb +16 -16
- data/spec/feedjira/parser/atom_feed_burner_entry_spec.rb +10 -10
- data/spec/feedjira/parser/atom_feed_burner_spec.rb +26 -26
- data/spec/feedjira/parser/atom_google_alerts_entry_spec.rb +6 -6
- data/spec/feedjira/parser/atom_google_alerts_spec.rb +13 -13
- data/spec/feedjira/parser/atom_spec.rb +23 -23
- data/spec/feedjira/parser/atom_youtube_entry_spec.rb +19 -19
- data/spec/feedjira/parser/atom_youtube_spec.rb +13 -13
- data/spec/feedjira/parser/google_docs_atom_entry_spec.rb +3 -3
- data/spec/feedjira/parser/google_docs_atom_spec.rb +8 -8
- data/spec/feedjira/parser/{itunes_rss_item_spec.rb → i_tunes_rss_item_spec.rb} +18 -18
- data/spec/feedjira/parser/{itunes_rss_owner_spec.rb → i_tunes_rss_owner_spec.rb} +3 -3
- data/spec/feedjira/parser/itunes_rss_spec.rb +26 -26
- data/spec/feedjira/parser/json_feed_item_spec.rb +11 -11
- data/spec/feedjira/parser/json_feed_spec.rb +13 -13
- data/spec/feedjira/parser/podlove_chapter_spec.rb +7 -7
- data/spec/feedjira/parser/rss_entry_spec.rb +19 -19
- data/spec/feedjira/parser/rss_feed_burner_entry_spec.rb +15 -15
- data/spec/feedjira/parser/rss_feed_burner_spec.rb +17 -17
- data/spec/feedjira/parser/rss_spec.rb +24 -24
- data/spec/feedjira/preprocessor_spec.rb +3 -3
- data/spec/feedjira_spec.rb +41 -41
- metadata +69 -11
@@ -3,64 +3,64 @@
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
5
|
describe Feedjira::Parser::AtomEntry do
|
6
|
-
before
|
6
|
+
before do
|
7
7
|
# I don't really like doing it this way because these unit test should only
|
8
8
|
# rely on AtomEntry, but this is actually how it should work. You would
|
9
9
|
# never just pass entry xml straight to the AtomEnry
|
10
10
|
@entry = Feedjira::Parser::Atom.parse(sample_atom_feed).entries.first
|
11
11
|
end
|
12
12
|
|
13
|
-
it "
|
13
|
+
it "parses the title" do
|
14
14
|
title = "AWS Job: Architect & Designer Position in Turkey"
|
15
15
|
expect(@entry.title).to eq title
|
16
16
|
end
|
17
17
|
|
18
|
-
it "
|
18
|
+
it "parses the url" do
|
19
19
|
expect(@entry.url).to eq "http://aws.typepad.com/aws/2009/01/aws-job-architect-designer-position-in-turkey.html"
|
20
20
|
end
|
21
21
|
|
22
|
-
it "
|
22
|
+
it "parses the url even when" do
|
23
23
|
xml = load_sample("atom_with_link_tag_for_url_unmarked.xml")
|
24
24
|
entries = Feedjira::Parser::Atom.parse(xml).entries
|
25
25
|
expect(entries.first.url).to eq "http://www.innoq.com/blog/phaus/2009/07/ja.html"
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "parses the author" do
|
29
29
|
expect(@entry.author).to eq "AWS Editor"
|
30
30
|
end
|
31
31
|
|
32
|
-
it "
|
32
|
+
it "parses the content" do
|
33
33
|
expect(@entry.content).to eq sample_atom_entry_content
|
34
34
|
end
|
35
35
|
|
36
|
-
it "
|
36
|
+
it "provides a summary" do
|
37
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..."
|
38
38
|
expect(@entry.summary).to eq summary
|
39
39
|
end
|
40
40
|
|
41
|
-
it "
|
41
|
+
it "parses the published date" do
|
42
42
|
published = Time.parse_safely "Fri Jan 16 18:21:00 UTC 2009"
|
43
43
|
expect(@entry.published).to eq published
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
46
|
+
it "parses the categories" do
|
47
47
|
expect(@entry.categories).to eq %w[Turkey Seattle]
|
48
48
|
end
|
49
49
|
|
50
|
-
it "
|
50
|
+
it "parses the updated date" do
|
51
51
|
updated = Time.parse_safely "Fri Jan 16 18:21:00 UTC 2009"
|
52
52
|
expect(@entry.updated).to eq updated
|
53
53
|
end
|
54
54
|
|
55
|
-
it "
|
55
|
+
it "parses the id" do
|
56
56
|
expect(@entry.id).to eq "tag:typepad.com,2003:post-61484736"
|
57
57
|
end
|
58
58
|
|
59
|
-
it "
|
59
|
+
it "supports each" do
|
60
60
|
expect(@entry).to respond_to :each
|
61
61
|
end
|
62
62
|
|
63
|
-
it "
|
63
|
+
it "is able to list out all fields with each" do
|
64
64
|
all_fields = []
|
65
65
|
title_value = ""
|
66
66
|
|
@@ -87,18 +87,18 @@ describe Feedjira::Parser::AtomEntry do
|
|
87
87
|
expect(all_fields.sort).to eq expected_fields
|
88
88
|
end
|
89
89
|
|
90
|
-
it "
|
90
|
+
it "supports checking if a field exists in the entry" do
|
91
91
|
expect(@entry).to include "author"
|
92
92
|
expect(@entry).to include "title"
|
93
93
|
end
|
94
94
|
|
95
|
-
it "
|
95
|
+
it "allows access to fields with hash syntax" do
|
96
96
|
title = "AWS Job: Architect & Designer Position in Turkey"
|
97
97
|
expect(@entry["title"]).to eq title
|
98
98
|
expect(@entry["author"]).to eq "AWS Editor"
|
99
99
|
end
|
100
100
|
|
101
|
-
it "
|
101
|
+
it "allows setting field values with hash syntax" do
|
102
102
|
@entry["title"] = "Foobar"
|
103
103
|
expect(@entry.title).to eq "Foobar"
|
104
104
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
5
|
describe Feedjira::Parser::AtomFeedBurnerEntry do
|
6
|
-
before
|
6
|
+
before do
|
7
7
|
Feedjira::Parser::AtomFeedBurner.preprocess_xml = false
|
8
8
|
# I don't really like doing it this way because these unit test should only
|
9
9
|
# rely on AtomEntry, but this is actually how it should work. You would
|
@@ -12,45 +12,45 @@ describe Feedjira::Parser::AtomFeedBurnerEntry do
|
|
12
12
|
@entry = feed.entries.first
|
13
13
|
end
|
14
14
|
|
15
|
-
it "
|
15
|
+
it "parses the title" do
|
16
16
|
expect(@entry.title).to eq "Making a Ruby C library even faster"
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
19
|
+
it "is able to fetch a url via the 'alternate' rel if no origLink exists" do
|
20
20
|
xml = File.read("#{File.dirname(__FILE__)}/../../sample_feeds/PaulDixExplainsNothingAlternate.xml")
|
21
21
|
entry = Feedjira::Parser::AtomFeedBurner.parse(xml).entries.first
|
22
22
|
expect(entry.url).to eq("http://feeds.feedburner.com/~r/PaulDixExplainsNothing/~3/519925023/making-a-ruby-c-library-even-faster.html")
|
23
23
|
end
|
24
24
|
|
25
|
-
it "
|
25
|
+
it "parses the url" do
|
26
26
|
expect(@entry.url).to eq "http://www.pauldix.net/2009/01/making-a-ruby-c-library-even-faster.html"
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "parses the url when there is no alternate" do
|
30
30
|
xml = File.read("#{File.dirname(__FILE__)}/../../sample_feeds/FeedBurnerUrlNoAlternate.xml")
|
31
31
|
entry = Feedjira::Parser::AtomFeedBurner.parse(xml).entries.first
|
32
32
|
expect(entry.url).to eq "http://example.com/QQQQ.html"
|
33
33
|
end
|
34
34
|
|
35
|
-
it "
|
35
|
+
it "parses the author" do
|
36
36
|
expect(@entry.author).to eq "Paul Dix"
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
39
|
+
it "parses the content" do
|
40
40
|
expect(@entry.content).to eq sample_feedburner_atom_entry_content
|
41
41
|
end
|
42
42
|
|
43
|
-
it "
|
43
|
+
it "provides a summary" do
|
44
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..."
|
45
45
|
expect(@entry.summary).to eq summary
|
46
46
|
end
|
47
47
|
|
48
|
-
it "
|
48
|
+
it "parses the published date" do
|
49
49
|
published = Time.parse_safely "Thu Jan 22 15:50:22 UTC 2009"
|
50
50
|
expect(@entry.published).to eq published
|
51
51
|
end
|
52
52
|
|
53
|
-
it "
|
53
|
+
it "parses the categories" do
|
54
54
|
expect(@entry.categories).to eq ["Ruby", "Another Category"]
|
55
55
|
end
|
56
56
|
end
|
@@ -5,66 +5,66 @@ require "spec_helper"
|
|
5
5
|
module Feedjira
|
6
6
|
module Parser
|
7
7
|
describe "#will_parse?" do
|
8
|
-
it "
|
8
|
+
it "returns true for a feedburner atom feed" do
|
9
9
|
expect(AtomFeedBurner).to be_able_to_parse(sample_feedburner_atom_feed)
|
10
10
|
end
|
11
11
|
|
12
|
-
it "
|
13
|
-
expect(AtomFeedBurner).
|
12
|
+
it "returns false for an rdf feed" do
|
13
|
+
expect(AtomFeedBurner).not_to be_able_to_parse(sample_rdf_feed)
|
14
14
|
end
|
15
15
|
|
16
|
-
it "
|
17
|
-
expect(AtomFeedBurner).
|
16
|
+
it "returns false for a regular atom feed" do
|
17
|
+
expect(AtomFeedBurner).not_to be_able_to_parse(sample_atom_feed)
|
18
18
|
end
|
19
19
|
|
20
|
-
it "
|
21
|
-
expect(AtomFeedBurner).
|
20
|
+
it "returns false for an rss feedburner feed" do
|
21
|
+
expect(AtomFeedBurner).not_to be_able_to_parse sample_rss_feed_burner_feed
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "parsing old style feeds" do
|
26
|
-
before
|
26
|
+
before do
|
27
27
|
@feed = AtomFeedBurner.parse(sample_feedburner_atom_feed)
|
28
28
|
end
|
29
29
|
|
30
|
-
it "
|
30
|
+
it "parses the title" do
|
31
31
|
expect(@feed.title).to eq "Paul Dix Explains Nothing"
|
32
32
|
end
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "parses the description" do
|
35
35
|
description = "Entrepreneurship, programming, software development, politics, NYC, and random thoughts."
|
36
36
|
expect(@feed.description).to eq description
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
39
|
+
it "parses the url" do
|
40
40
|
expect(@feed.url).to eq "http://www.pauldix.net/"
|
41
41
|
end
|
42
42
|
|
43
|
-
it "
|
43
|
+
it "parses the feed_url" do
|
44
44
|
expect(@feed.feed_url).to eq "http://feeds.feedburner.com/PaulDixExplainsNothing"
|
45
45
|
end
|
46
46
|
|
47
|
-
it "
|
47
|
+
it "parses no hub urls" do
|
48
48
|
expect(@feed.hubs.count).to eq 0
|
49
49
|
end
|
50
50
|
|
51
|
-
it "
|
51
|
+
it "parses hub urls" do
|
52
52
|
AtomFeedBurner.preprocess_xml = false
|
53
53
|
feed_with_hub = AtomFeedBurner.parse(load_sample("TypePadNews.xml"))
|
54
54
|
expect(feed_with_hub.hubs.count).to eq 1
|
55
55
|
end
|
56
56
|
|
57
|
-
it "
|
57
|
+
it "parses entries" do
|
58
58
|
expect(@feed.entries.size).to eq 5
|
59
59
|
end
|
60
60
|
|
61
|
-
it "
|
61
|
+
it "changes url" do
|
62
62
|
new_url = "http://some.url.com"
|
63
63
|
expect { @feed.url = new_url }.not_to raise_error
|
64
64
|
expect(@feed.url).to eq new_url
|
65
65
|
end
|
66
66
|
|
67
|
-
it "
|
67
|
+
it "changes feed_url" do
|
68
68
|
new_url = "http://some.url.com"
|
69
69
|
expect { @feed.feed_url = new_url }.not_to raise_error
|
70
70
|
expect(@feed.feed_url).to eq new_url
|
@@ -72,42 +72,42 @@ module Feedjira
|
|
72
72
|
end
|
73
73
|
|
74
74
|
describe "parsing alternate style feeds" do
|
75
|
-
before
|
75
|
+
before do
|
76
76
|
@feed = AtomFeedBurner.parse(sample_feedburner_atom_feed_alternate)
|
77
77
|
end
|
78
78
|
|
79
|
-
it "
|
79
|
+
it "parses the title" do
|
80
80
|
expect(@feed.title).to eq "Giant Robots Smashing Into Other Giant Robots"
|
81
81
|
end
|
82
82
|
|
83
|
-
it "
|
83
|
+
it "parses the description" do
|
84
84
|
description = "Written by thoughtbot"
|
85
85
|
expect(@feed.description).to eq description
|
86
86
|
end
|
87
87
|
|
88
|
-
it "
|
88
|
+
it "parses the url" do
|
89
89
|
expect(@feed.url).to eq "https://robots.thoughtbot.com"
|
90
90
|
end
|
91
91
|
|
92
|
-
it "
|
92
|
+
it "parses the feed_url" do
|
93
93
|
expect(@feed.feed_url).to eq "http://feeds.feedburner.com/GiantRobotsSmashingIntoOtherGiantRobots"
|
94
94
|
end
|
95
95
|
|
96
|
-
it "
|
96
|
+
it "parses hub urls" do
|
97
97
|
expect(@feed.hubs.count).to eq 1
|
98
98
|
end
|
99
99
|
|
100
|
-
it "
|
100
|
+
it "parses entries" do
|
101
101
|
expect(@feed.entries.size).to eq 3
|
102
102
|
end
|
103
103
|
|
104
|
-
it "
|
104
|
+
it "changes url" do
|
105
105
|
new_url = "http://some.url.com"
|
106
106
|
expect { @feed.url = new_url }.not_to raise_error
|
107
107
|
expect(@feed.url).to eq new_url
|
108
108
|
end
|
109
109
|
|
110
|
-
it "
|
110
|
+
it "changes feed_url" do
|
111
111
|
new_url = "http://some.url.com"
|
112
112
|
expect { @feed.feed_url = new_url }.not_to raise_error
|
113
113
|
expect(@feed.feed_url).to eq new_url
|
@@ -3,31 +3,31 @@
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
5
|
describe Feedjira::Parser::AtomGoogleAlertsEntry do
|
6
|
-
before
|
6
|
+
before do
|
7
7
|
feed = Feedjira::Parser::AtomGoogleAlerts.parse sample_google_alerts_atom_feed
|
8
8
|
@entry = feed.entries.first
|
9
9
|
end
|
10
10
|
|
11
|
-
it "
|
11
|
+
it "parses the title" do
|
12
12
|
expect(@entry.title).to eq "Report offers Prediction of Automotive Slack Market by Top key players like Haldex, Meritor, Bendix ..."
|
13
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
14
|
expect(@entry.title_type).to eq "html"
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "parses the url" do
|
18
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
19
|
end
|
20
20
|
|
21
|
-
it "
|
21
|
+
it "parses the content" do
|
22
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
23
|
end
|
24
24
|
|
25
|
-
it "
|
25
|
+
it "parses the published date" do
|
26
26
|
published = Time.parse_safely "2019-07-10T11:53:37Z"
|
27
27
|
expect(@entry.published).to eq published
|
28
28
|
end
|
29
29
|
|
30
|
-
it "
|
30
|
+
it "parses the updated date" do
|
31
31
|
updated = Time.parse_safely "2019-07-10T11:53:37Z"
|
32
32
|
expect(@entry.updated).to eq updated
|
33
33
|
end
|
@@ -5,45 +5,45 @@ require "spec_helper"
|
|
5
5
|
module Feedjira
|
6
6
|
module Parser
|
7
7
|
describe "#able_to_parse?" do
|
8
|
-
it "
|
8
|
+
it "returns true for a Google Alerts atom feed" do
|
9
9
|
expect(AtomGoogleAlerts).to be_able_to_parse(sample_google_alerts_atom_feed)
|
10
10
|
end
|
11
11
|
|
12
|
-
it "
|
13
|
-
expect(AtomGoogleAlerts).
|
12
|
+
it "returns false for an rdf feed" do
|
13
|
+
expect(AtomGoogleAlerts).not_to be_able_to_parse(sample_rdf_feed)
|
14
14
|
end
|
15
15
|
|
16
|
-
it "
|
17
|
-
expect(AtomGoogleAlerts).
|
16
|
+
it "returns false for a regular atom feed" do
|
17
|
+
expect(AtomGoogleAlerts).not_to be_able_to_parse(sample_atom_feed)
|
18
18
|
end
|
19
19
|
|
20
|
-
it "
|
21
|
-
expect(AtomGoogleAlerts).
|
20
|
+
it "returns false for a feedburner atom feed" do
|
21
|
+
expect(AtomGoogleAlerts).not_to be_able_to_parse(sample_feedburner_atom_feed)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "parsing" do
|
26
|
-
before
|
26
|
+
before do
|
27
27
|
@feed = AtomGoogleAlerts.parse(sample_google_alerts_atom_feed)
|
28
28
|
end
|
29
29
|
|
30
|
-
it "
|
30
|
+
it "parses the title" do
|
31
31
|
expect(@feed.title).to eq "Google Alert - Slack"
|
32
32
|
end
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "parses the descripton" do
|
35
35
|
expect(@feed.description).to be_nil
|
36
36
|
end
|
37
37
|
|
38
|
-
it "
|
38
|
+
it "parses the url" do
|
39
39
|
expect(@feed.url).to eq "https://www.google.com/alerts/feeds/04175468913983673025/4428013283581841004"
|
40
40
|
end
|
41
41
|
|
42
|
-
it "
|
42
|
+
it "parses the feed_url" do
|
43
43
|
expect(@feed.feed_url).to eq "https://www.google.com/alerts/feeds/04175468913983673025/4428013283581841004"
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
46
|
+
it "parses entries" do
|
47
47
|
expect(@feed.entries.size).to eq 20
|
48
48
|
end
|
49
49
|
end
|
@@ -5,72 +5,72 @@ require "spec_helper"
|
|
5
5
|
module Feedjira
|
6
6
|
module Parser
|
7
7
|
describe "#will_parse?" do
|
8
|
-
it "
|
8
|
+
it "returns true for an atom feed" do
|
9
9
|
expect(Atom).to be_able_to_parse(sample_atom_feed)
|
10
10
|
end
|
11
11
|
|
12
|
-
it "
|
13
|
-
expect(Atom).
|
12
|
+
it "returns false for an rdf feed" do
|
13
|
+
expect(Atom).not_to be_able_to_parse(sample_rdf_feed)
|
14
14
|
end
|
15
15
|
|
16
|
-
it "
|
17
|
-
expect(Atom).
|
16
|
+
it "returns false for an rss feedburner feed" do
|
17
|
+
expect(Atom).not_to be_able_to_parse(sample_rss_feed_burner_feed)
|
18
18
|
end
|
19
19
|
|
20
|
-
it "
|
20
|
+
it "returns true for an atom feed that has line breaks in between attributes in the <feed> node" do
|
21
21
|
expect(Atom).to be_able_to_parse(sample_atom_feed_line_breaks)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "parsing" do
|
26
|
-
before
|
26
|
+
before do
|
27
27
|
@feed = Atom.parse(sample_atom_feed)
|
28
28
|
end
|
29
29
|
|
30
|
-
it "
|
30
|
+
it "parses the title" do
|
31
31
|
expect(@feed.title).to eq "Amazon Web Services Blog"
|
32
32
|
end
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "parses the description" do
|
35
35
|
description = "Amazon Web Services, Products, Tools, and Developer Information..."
|
36
36
|
expect(@feed.description).to eq description
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
39
|
+
it "parses the icon url" do
|
40
40
|
feed_with_icon = Atom.parse(load_sample("SamRuby.xml"))
|
41
41
|
expect(feed_with_icon.icon).to eq "../favicon.ico"
|
42
42
|
end
|
43
43
|
|
44
|
-
it "
|
44
|
+
it "parses the url" do
|
45
45
|
expect(@feed.url).to eq "http://aws.typepad.com/aws/"
|
46
46
|
end
|
47
47
|
|
48
|
-
it "
|
48
|
+
it "parses the url even when it doesn't have the type='text/html' attribute" do
|
49
49
|
xml = load_sample "atom_with_link_tag_for_url_unmarked.xml"
|
50
50
|
feed = Atom.parse xml
|
51
51
|
expect(feed.url).to eq "http://www.innoq.com/planet/"
|
52
52
|
end
|
53
53
|
|
54
|
-
it "
|
54
|
+
it "parses the feed_url even when it doesn't have the type='application/atom+xml' attribute" do
|
55
55
|
feed = Atom.parse(load_sample("atom_with_link_tag_for_url_unmarked.xml"))
|
56
56
|
expect(feed.feed_url).to eq "http://www.innoq.com/planet/atom.xml"
|
57
57
|
end
|
58
58
|
|
59
|
-
it "
|
59
|
+
it "parses the feed_url" do
|
60
60
|
expect(@feed.feed_url).to eq "http://aws.typepad.com/aws/atom.xml"
|
61
61
|
end
|
62
62
|
|
63
|
-
it "
|
63
|
+
it "parses no hub urls" do
|
64
64
|
expect(@feed.hubs.count).to eq 0
|
65
65
|
end
|
66
66
|
|
67
|
-
it "
|
67
|
+
it "parses the hub urls" do
|
68
68
|
feed_with_hub = Atom.parse(load_sample("SamRuby.xml"))
|
69
69
|
expect(feed_with_hub.hubs.count).to eq 1
|
70
70
|
expect(feed_with_hub.hubs.first).to eq "http://pubsubhubbub.appspot.com/"
|
71
71
|
end
|
72
72
|
|
73
|
-
it "
|
73
|
+
it "parses entries" do
|
74
74
|
expect(@feed.entries.size).to eq 10
|
75
75
|
end
|
76
76
|
end
|
@@ -89,7 +89,7 @@ module Feedjira
|
|
89
89
|
expect(entry.content).to match(/\A<p/)
|
90
90
|
end
|
91
91
|
|
92
|
-
it "
|
92
|
+
it "does not duplicate content when there are divs in content" do
|
93
93
|
Atom.preprocess_xml = true
|
94
94
|
|
95
95
|
feed = Atom.parse sample_duplicate_content_atom_feed
|
@@ -99,25 +99,25 @@ module Feedjira
|
|
99
99
|
end
|
100
100
|
|
101
101
|
describe "parsing url and feed_url" do
|
102
|
-
before
|
102
|
+
before do
|
103
103
|
@feed = Atom.parse(sample_atom_middleman_feed)
|
104
104
|
end
|
105
105
|
|
106
|
-
it "
|
106
|
+
it "parses url" do
|
107
107
|
expect(@feed.url).to eq "http://feedjira.com/blog"
|
108
108
|
end
|
109
109
|
|
110
|
-
it "
|
110
|
+
it "parses feed_url" do
|
111
111
|
expect(@feed.feed_url).to eq "http://feedjira.com/blog/feed.xml"
|
112
112
|
end
|
113
113
|
|
114
|
-
it "
|
114
|
+
it "does not parse links without the rel='self' attribute as feed_url" do
|
115
115
|
xml = load_sample "atom_simple_single_entry.xml"
|
116
116
|
feed = Atom.parse xml
|
117
117
|
expect(feed.feed_url).to be_nil
|
118
118
|
end
|
119
119
|
|
120
|
-
it "
|
120
|
+
it "does not parse links with the rel='self' attribute as url" do
|
121
121
|
xml = load_sample "atom_simple_single_entry_link_self.xml"
|
122
122
|
feed = Atom.parse xml
|
123
123
|
expect(feed.url).to be_nil
|
@@ -9,79 +9,79 @@ describe Feedjira::Parser::AtomYoutubeEntry do
|
|
9
9
|
@entry = @feed.entries.first
|
10
10
|
end
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "has the title" do
|
13
13
|
expect(@entry.title).to eq "The Google app: Questions Title"
|
14
14
|
end
|
15
15
|
|
16
|
-
it "
|
16
|
+
it "has the url" do
|
17
17
|
expect(@entry.url).to eq "http://www.youtube.com/watch?v=5shykyfmb28"
|
18
18
|
end
|
19
19
|
|
20
|
-
it "
|
20
|
+
it "has the entry id" do
|
21
21
|
expect(@entry.entry_id).to eq "yt:video:5shykyfmb28"
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "has the published date" do
|
25
25
|
expect(@entry.published).to eq Time.parse_safely("2015-05-04T00:01:27+00:00")
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "has the updated date" do
|
29
29
|
expect(@entry.updated).to eq Time.parse_safely("2015-05-13T17:38:30+00:00")
|
30
30
|
end
|
31
31
|
|
32
|
-
it "
|
32
|
+
it "has the content populated from the media:description element" do
|
33
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"
|
34
34
|
end
|
35
35
|
|
36
|
-
it "
|
36
|
+
it "has the summary but blank" do
|
37
37
|
expect(@entry.summary).to be_nil
|
38
38
|
end
|
39
39
|
|
40
|
-
it "
|
40
|
+
it "has the custom youtube video id" do
|
41
41
|
expect(@entry.youtube_video_id).to eq "5shykyfmb28"
|
42
42
|
end
|
43
43
|
|
44
|
-
it "
|
44
|
+
it "has the custom media title" do
|
45
45
|
expect(@entry.media_title).to eq "The Google app: Questions"
|
46
46
|
end
|
47
47
|
|
48
|
-
it "
|
48
|
+
it "has the custom media url" do
|
49
49
|
expect(@entry.media_url).to eq "https://www.youtube.com/v/5shykyfmb28?version=3"
|
50
50
|
end
|
51
51
|
|
52
|
-
it "
|
52
|
+
it "has the custom media type" do
|
53
53
|
expect(@entry.media_type).to eq "application/x-shockwave-flash"
|
54
54
|
end
|
55
55
|
|
56
|
-
it "
|
56
|
+
it "has the custom media width" do
|
57
57
|
expect(@entry.media_width).to eq "640"
|
58
58
|
end
|
59
59
|
|
60
|
-
it "
|
60
|
+
it "has the custom media height" do
|
61
61
|
expect(@entry.media_height).to eq "390"
|
62
62
|
end
|
63
63
|
|
64
|
-
it "
|
64
|
+
it "has the custom media thumbnail url" do
|
65
65
|
expect(@entry.media_thumbnail_url).to eq "https://i2.ytimg.com/vi/5shykyfmb28/hqdefault.jpg"
|
66
66
|
end
|
67
67
|
|
68
|
-
it "
|
68
|
+
it "has the custom media thumbnail width" do
|
69
69
|
expect(@entry.media_thumbnail_width).to eq "480"
|
70
70
|
end
|
71
71
|
|
72
|
-
it "
|
72
|
+
it "has the custom media thumbnail height" do
|
73
73
|
expect(@entry.media_thumbnail_height).to eq "360"
|
74
74
|
end
|
75
75
|
|
76
|
-
it "
|
76
|
+
it "has the custom media star count" do
|
77
77
|
expect(@entry.media_star_count).to eq "3546"
|
78
78
|
end
|
79
79
|
|
80
|
-
it "
|
80
|
+
it "has the custom media star average" do
|
81
81
|
expect(@entry.media_star_average).to eq "4.79"
|
82
82
|
end
|
83
83
|
|
84
|
-
it "
|
84
|
+
it "has the custom media views" do
|
85
85
|
expect(@entry.media_views).to eq "251497"
|
86
86
|
end
|
87
87
|
end
|