feedjira 3.1.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/feed-parsing.md +15 -0
- data/.github/ISSUE_TEMPLATE/general-issue.md +8 -0
- data/.github/workflows/ruby.yml +39 -0
- data/.rubocop.yml +34 -615
- data/.rubocop_todo.yml +4 -29
- data/CHANGELOG.md +60 -13
- data/Gemfile +3 -4
- data/Rakefile +3 -1
- data/feedjira.gemspec +12 -12
- data/lib/feedjira/configuration.rb +5 -3
- 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 +3 -1
- data/lib/feedjira/core_ext.rb +2 -0
- data/lib/feedjira/date_time_utilities/date_time_epoch_parser.rb +3 -0
- data/lib/feedjira/date_time_utilities/date_time_language_parser.rb +5 -3
- data/lib/feedjira/date_time_utilities/date_time_pattern_parser.rb +9 -9
- data/lib/feedjira/date_time_utilities.rb +8 -8
- data/lib/feedjira/feed.rb +3 -1
- data/lib/feedjira/feed_entry_utilities.rb +5 -3
- data/lib/feedjira/feed_utilities.rb +8 -5
- data/lib/feedjira/parser/atom.rb +5 -6
- 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 +8 -5
- data/lib/feedjira/parser/atom_youtube.rb +4 -2
- 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 +5 -3
- 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 +8 -6
- 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 +5 -2
- 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 +4 -2
- data/lib/feedjira/parser/rss_feed_burner_entry.rb +2 -2
- data/lib/feedjira/parser/rss_image.rb +2 -0
- data/lib/feedjira/parser.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/lib/feedjira.rb +2 -1
- data/spec/feedjira/configuration_spec.rb +5 -3
- data/spec/feedjira/feed_spec.rb +13 -10
- data/spec/feedjira/{date_time_utilities_spec.rb → feed_utilities_date_time_spec.rb} +9 -7
- data/spec/feedjira/{feed_entry_utilities_spec.rb → feed_utilities_entry_spec.rb} +12 -10
- data/spec/feedjira/feed_utilities_spec.rb +37 -40
- data/spec/feedjira/parser/atom_entry_spec.rb +22 -20
- data/spec/feedjira/parser/atom_feed_burner_entry_spec.rb +16 -14
- data/spec/feedjira/parser/atom_feed_burner_spec.rb +30 -28
- data/spec/feedjira/parser/atom_google_alerts_entry_spec.rb +12 -10
- data/spec/feedjira/parser/atom_google_alerts_spec.rb +15 -13
- data/spec/feedjira/parser/atom_spec.rb +44 -25
- data/spec/feedjira/parser/atom_youtube_entry_spec.rb +25 -23
- data/spec/feedjira/parser/atom_youtube_spec.rb +16 -14
- data/spec/feedjira/parser/google_docs_atom_entry_spec.rb +5 -3
- data/spec/feedjira/parser/google_docs_atom_spec.rb +10 -8
- data/spec/feedjira/parser/{itunes_rss_item_spec.rb → i_tunes_rss_item_spec.rb} +21 -19
- data/spec/feedjira/parser/{itunes_rss_owner_spec.rb → i_tunes_rss_owner_spec.rb} +5 -3
- data/spec/feedjira/parser/itunes_rss_spec.rb +35 -33
- data/spec/feedjira/parser/json_feed_item_spec.rb +16 -14
- data/spec/feedjira/parser/json_feed_spec.rb +15 -13
- data/spec/feedjira/parser/podlove_chapter_spec.rb +9 -7
- data/spec/feedjira/parser/rss_entry_spec.rb +25 -23
- data/spec/feedjira/parser/rss_feed_burner_entry_spec.rb +24 -22
- data/spec/feedjira/parser/rss_feed_burner_spec.rb +20 -18
- data/spec/feedjira/parser/rss_spec.rb +26 -24
- data/spec/feedjira/preprocessor_spec.rb +6 -4
- data/spec/feedjira_spec.rb +50 -39
- 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.rb +6 -1
- data/spec/spec_helper.rb +3 -7
- metadata +60 -24
- data/.travis.yml +0 -34
- data/Dangerfile +0 -1
@@ -1,47 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
module Feedjira
|
4
6
|
module Parser
|
5
7
|
describe "#able_to_parse?" do
|
6
|
-
it "
|
8
|
+
it "returns true for a Google Alerts atom feed" do
|
7
9
|
expect(AtomGoogleAlerts).to be_able_to_parse(sample_google_alerts_atom_feed)
|
8
10
|
end
|
9
11
|
|
10
|
-
it "
|
11
|
-
expect(AtomGoogleAlerts).
|
12
|
+
it "returns false for an rdf feed" do
|
13
|
+
expect(AtomGoogleAlerts).not_to be_able_to_parse(sample_rdf_feed)
|
12
14
|
end
|
13
15
|
|
14
|
-
it "
|
15
|
-
expect(AtomGoogleAlerts).
|
16
|
+
it "returns false for a regular atom feed" do
|
17
|
+
expect(AtomGoogleAlerts).not_to be_able_to_parse(sample_atom_feed)
|
16
18
|
end
|
17
19
|
|
18
|
-
it "
|
19
|
-
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)
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
23
25
|
describe "parsing" do
|
24
|
-
before
|
26
|
+
before do
|
25
27
|
@feed = AtomGoogleAlerts.parse(sample_google_alerts_atom_feed)
|
26
28
|
end
|
27
29
|
|
28
|
-
it "
|
30
|
+
it "parses the title" do
|
29
31
|
expect(@feed.title).to eq "Google Alert - Slack"
|
30
32
|
end
|
31
33
|
|
32
|
-
it "
|
34
|
+
it "parses the descripton" do
|
33
35
|
expect(@feed.description).to be_nil
|
34
36
|
end
|
35
37
|
|
36
|
-
it "
|
38
|
+
it "parses the url" do
|
37
39
|
expect(@feed.url).to eq "https://www.google.com/alerts/feeds/04175468913983673025/4428013283581841004"
|
38
40
|
end
|
39
41
|
|
40
|
-
it "
|
42
|
+
it "parses the feed_url" do
|
41
43
|
expect(@feed.feed_url).to eq "https://www.google.com/alerts/feeds/04175468913983673025/4428013283581841004"
|
42
44
|
end
|
43
45
|
|
44
|
-
it "
|
46
|
+
it "parses entries" do
|
45
47
|
expect(@feed.entries.size).to eq 20
|
46
48
|
end
|
47
49
|
end
|
@@ -1,69 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
module Feedjira
|
4
6
|
module Parser
|
5
7
|
describe "#will_parse?" do
|
6
|
-
it "
|
8
|
+
it "returns true for an atom feed" do
|
7
9
|
expect(Atom).to be_able_to_parse(sample_atom_feed)
|
8
10
|
end
|
9
11
|
|
10
|
-
it "
|
11
|
-
expect(Atom).
|
12
|
+
it "returns false for an rdf feed" do
|
13
|
+
expect(Atom).not_to be_able_to_parse(sample_rdf_feed)
|
12
14
|
end
|
13
15
|
|
14
|
-
it "
|
15
|
-
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)
|
16
18
|
end
|
17
19
|
|
18
|
-
it "
|
20
|
+
it "returns 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
|
22
24
|
|
23
25
|
describe "parsing" do
|
24
|
-
before
|
26
|
+
before do
|
25
27
|
@feed = Atom.parse(sample_atom_feed)
|
26
28
|
end
|
27
29
|
|
28
|
-
it "
|
30
|
+
it "parses the title" do
|
29
31
|
expect(@feed.title).to eq "Amazon Web Services Blog"
|
30
32
|
end
|
31
33
|
|
32
|
-
it "
|
33
|
-
description = "Amazon Web Services, Products, Tools, and Developer Information..."
|
34
|
+
it "parses the description" do
|
35
|
+
description = "Amazon Web Services, Products, Tools, and Developer Information..."
|
34
36
|
expect(@feed.description).to eq description
|
35
37
|
end
|
36
38
|
|
37
|
-
it "
|
39
|
+
it "parses 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
|
+
|
44
|
+
it "parses the url" do
|
38
45
|
expect(@feed.url).to eq "http://aws.typepad.com/aws/"
|
39
46
|
end
|
40
47
|
|
41
|
-
it "
|
48
|
+
it "parses 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 "
|
54
|
+
it "parses 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
|
51
58
|
|
52
|
-
it "
|
59
|
+
it "parses the feed_url" do
|
53
60
|
expect(@feed.feed_url).to eq "http://aws.typepad.com/aws/atom.xml"
|
54
61
|
end
|
55
62
|
|
56
|
-
it "
|
63
|
+
it "parses no hub urls" do
|
57
64
|
expect(@feed.hubs.count).to eq 0
|
58
65
|
end
|
59
66
|
|
60
|
-
it "
|
67
|
+
it "parses the hub urls" do
|
61
68
|
feed_with_hub = Atom.parse(load_sample("SamRuby.xml"))
|
62
69
|
expect(feed_with_hub.hubs.count).to eq 1
|
63
70
|
expect(feed_with_hub.hubs.first).to eq "http://pubsubhubbub.appspot.com/"
|
64
71
|
end
|
65
72
|
|
66
|
-
it "
|
73
|
+
it "parses entries" do
|
67
74
|
expect(@feed.entries.size).to eq 10
|
68
75
|
end
|
69
76
|
end
|
@@ -75,14 +82,14 @@ module Feedjira
|
|
75
82
|
feed = Atom.parse sample_atom_xhtml_feed
|
76
83
|
entry = feed.entries.first
|
77
84
|
|
78
|
-
expect(entry.raw_title).to match(
|
85
|
+
expect(entry.raw_title).to match(/<i/)
|
79
86
|
expect(entry.title).to eq("Sentry Calming Collar for dogs")
|
80
87
|
expect(entry.title_type).to eq("xhtml")
|
81
|
-
expect(entry.summary).to match(
|
82
|
-
expect(entry.content).to match(/\A
|
88
|
+
expect(entry.summary).to match(/<b/)
|
89
|
+
expect(entry.content).to match(/\A<p/)
|
83
90
|
end
|
84
91
|
|
85
|
-
it "
|
92
|
+
it "does not duplicate content when there are divs in content" do
|
86
93
|
Atom.preprocess_xml = true
|
87
94
|
|
88
95
|
feed = Atom.parse sample_duplicate_content_atom_feed
|
@@ -91,18 +98,30 @@ module Feedjira
|
|
91
98
|
end
|
92
99
|
end
|
93
100
|
|
94
|
-
describe "parsing url and
|
95
|
-
before
|
101
|
+
describe "parsing url and feed_url" do
|
102
|
+
before do
|
96
103
|
@feed = Atom.parse(sample_atom_middleman_feed)
|
97
104
|
end
|
98
105
|
|
99
|
-
it "
|
106
|
+
it "parses url" do
|
100
107
|
expect(@feed.url).to eq "http://feedjira.com/blog"
|
101
108
|
end
|
102
109
|
|
103
|
-
it "
|
110
|
+
it "parses feed_url" do
|
104
111
|
expect(@feed.feed_url).to eq "http://feedjira.com/blog/feed.xml"
|
105
112
|
end
|
113
|
+
|
114
|
+
it "does 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 "does 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
|
106
125
|
end
|
107
126
|
end
|
108
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
|
@@ -7,79 +9,79 @@ describe Feedjira::Parser::AtomYoutubeEntry do
|
|
7
9
|
@entry = @feed.entries.first
|
8
10
|
end
|
9
11
|
|
10
|
-
it "
|
12
|
+
it "has the title" do
|
11
13
|
expect(@entry.title).to eq "The Google app: Questions Title"
|
12
14
|
end
|
13
15
|
|
14
|
-
it "
|
16
|
+
it "has the url" do
|
15
17
|
expect(@entry.url).to eq "http://www.youtube.com/watch?v=5shykyfmb28"
|
16
18
|
end
|
17
19
|
|
18
|
-
it "
|
20
|
+
it "has the entry id" do
|
19
21
|
expect(@entry.entry_id).to eq "yt:video:5shykyfmb28"
|
20
22
|
end
|
21
23
|
|
22
|
-
it "
|
24
|
+
it "has the published date" do
|
23
25
|
expect(@entry.published).to eq Time.parse_safely("2015-05-04T00:01:27+00:00")
|
24
26
|
end
|
25
27
|
|
26
|
-
it "
|
28
|
+
it "has the updated date" do
|
27
29
|
expect(@entry.updated).to eq Time.parse_safely("2015-05-13T17:38:30+00:00")
|
28
30
|
end
|
29
31
|
|
30
|
-
it "
|
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"
|
32
|
+
it "has the content populated from the media:description element" do
|
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
|
-
it "
|
36
|
+
it "has the summary but blank" do
|
35
37
|
expect(@entry.summary).to be_nil
|
36
38
|
end
|
37
39
|
|
38
|
-
it "
|
40
|
+
it "has the custom youtube video id" do
|
39
41
|
expect(@entry.youtube_video_id).to eq "5shykyfmb28"
|
40
42
|
end
|
41
43
|
|
42
|
-
it "
|
44
|
+
it "has the custom media title" do
|
43
45
|
expect(@entry.media_title).to eq "The Google app: Questions"
|
44
46
|
end
|
45
47
|
|
46
|
-
it "
|
47
|
-
expect(@entry.media_url).to eq "https://www.youtube.com/v/5shykyfmb28?version=3"
|
48
|
+
it "has the custom media url" do
|
49
|
+
expect(@entry.media_url).to eq "https://www.youtube.com/v/5shykyfmb28?version=3"
|
48
50
|
end
|
49
51
|
|
50
|
-
it "
|
52
|
+
it "has the custom media type" do
|
51
53
|
expect(@entry.media_type).to eq "application/x-shockwave-flash"
|
52
54
|
end
|
53
55
|
|
54
|
-
it "
|
56
|
+
it "has the custom media width" do
|
55
57
|
expect(@entry.media_width).to eq "640"
|
56
58
|
end
|
57
59
|
|
58
|
-
it "
|
60
|
+
it "has the custom media height" do
|
59
61
|
expect(@entry.media_height).to eq "390"
|
60
62
|
end
|
61
63
|
|
62
|
-
it "
|
63
|
-
expect(@entry.media_thumbnail_url).to eq "https://i2.ytimg.com/vi/5shykyfmb28/hqdefault.jpg"
|
64
|
+
it "has the custom media thumbnail url" do
|
65
|
+
expect(@entry.media_thumbnail_url).to eq "https://i2.ytimg.com/vi/5shykyfmb28/hqdefault.jpg"
|
64
66
|
end
|
65
67
|
|
66
|
-
it "
|
68
|
+
it "has the custom media thumbnail width" do
|
67
69
|
expect(@entry.media_thumbnail_width).to eq "480"
|
68
70
|
end
|
69
71
|
|
70
|
-
it "
|
72
|
+
it "has the custom media thumbnail height" do
|
71
73
|
expect(@entry.media_thumbnail_height).to eq "360"
|
72
74
|
end
|
73
75
|
|
74
|
-
it "
|
76
|
+
it "has the custom media star count" do
|
75
77
|
expect(@entry.media_star_count).to eq "3546"
|
76
78
|
end
|
77
79
|
|
78
|
-
it "
|
80
|
+
it "has the custom media star average" do
|
79
81
|
expect(@entry.media_star_average).to eq "4.79"
|
80
82
|
end
|
81
83
|
|
82
|
-
it "
|
84
|
+
it "has the custom media views" do
|
83
85
|
expect(@entry.media_views).to eq "251497"
|
84
86
|
end
|
85
87
|
end
|
@@ -1,42 +1,44 @@
|
|
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
|
-
it "
|
6
|
-
expect(
|
7
|
+
it "returns true for an atom youtube feed" do
|
8
|
+
expect(described_class).to be_able_to_parse(sample_youtube_atom_feed)
|
7
9
|
end
|
8
10
|
|
9
|
-
it "
|
10
|
-
expect(
|
11
|
+
it "returns fase for an atom feed" do
|
12
|
+
expect(described_class).not_to be_able_to_parse(sample_atom_feed)
|
11
13
|
end
|
12
14
|
|
13
|
-
it "
|
14
|
-
expect(
|
15
|
+
it "returns false for an rss feedburner feed" do
|
16
|
+
expect(described_class).not_to be_able_to_parse(sample_rss_feed_burner_feed)
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
18
20
|
describe "parsing" do
|
19
|
-
before
|
20
|
-
@feed =
|
21
|
+
before do
|
22
|
+
@feed = described_class.parse(sample_youtube_atom_feed)
|
21
23
|
end
|
22
24
|
|
23
|
-
it "
|
25
|
+
it "parses the title" do
|
24
26
|
expect(@feed.title).to eq "Google"
|
25
27
|
end
|
26
28
|
|
27
|
-
it "
|
29
|
+
it "parses the author" do
|
28
30
|
expect(@feed.author).to eq "Google Author"
|
29
31
|
end
|
30
32
|
|
31
|
-
it "
|
33
|
+
it "parses the url" do
|
32
34
|
expect(@feed.url).to eq "http://www.youtube.com/user/Google"
|
33
35
|
end
|
34
36
|
|
35
|
-
it "
|
37
|
+
it "parses the feed_url" do
|
36
38
|
expect(@feed.feed_url).to eq "http://www.youtube.com/feeds/videos.xml?user=google"
|
37
39
|
end
|
38
40
|
|
39
|
-
it "
|
41
|
+
it "parses the YouTube channel id" do
|
40
42
|
expect(@feed.youtube_channel_id).to eq "UCK8sQmJBp8GCxrOtXWBpyEA"
|
41
43
|
end
|
42
44
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Feedjira::Parser::GoogleDocsAtomEntry do
|
@@ -8,15 +10,15 @@ describe Feedjira::Parser::GoogleDocsAtomEntry do
|
|
8
10
|
@entry = @feed.entries.first
|
9
11
|
end
|
10
12
|
|
11
|
-
it "
|
13
|
+
it "has the custom checksum element" do
|
12
14
|
expect(@entry.checksum).to eq "2b01142f7481c7b056c4b410d28f33cf"
|
13
15
|
end
|
14
16
|
|
15
|
-
it "
|
17
|
+
it "has the custom filename element" do
|
16
18
|
expect(@entry.original_filename).to eq "MyFile.pdf"
|
17
19
|
end
|
18
20
|
|
19
|
-
it "
|
21
|
+
it "has the custom suggested filename element" do
|
20
22
|
expect(@entry.suggested_filename).to eq "TaxDocument.pdf"
|
21
23
|
end
|
22
24
|
end
|
@@ -1,14 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
module Feedjira
|
4
6
|
module Parser
|
5
7
|
describe ".able_to_parser?" do
|
6
|
-
it "
|
8
|
+
it "returns true for Google Docs feed" do
|
7
9
|
expect(GoogleDocsAtom).to be_able_to_parse(sample_google_docs_list_feed)
|
8
10
|
end
|
9
11
|
|
10
|
-
it "
|
11
|
-
expect(GoogleDocsAtom).
|
12
|
+
it "is not able to parse another Atom feed" do
|
13
|
+
expect(GoogleDocsAtom).not_to be_able_to_parse(sample_atom_feed)
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
@@ -17,15 +19,15 @@ module Feedjira
|
|
17
19
|
@feed = GoogleDocsAtom.parse(sample_google_docs_list_feed)
|
18
20
|
end
|
19
21
|
|
20
|
-
it "
|
21
|
-
expect(@feed.entries).
|
22
|
+
it "returns a bunch of objects" do
|
23
|
+
expect(@feed.entries).not_to be_empty
|
22
24
|
end
|
23
25
|
|
24
|
-
it "
|
25
|
-
expect(@feed.title).
|
26
|
+
it "populates a title, interhited from the Atom entry" do
|
27
|
+
expect(@feed.title).not_to be_nil
|
26
28
|
end
|
27
29
|
|
28
|
-
it "
|
30
|
+
it "returns a bunch of entries of type GoogleDocsAtomEntry" do
|
29
31
|
expect(@feed.entries.first).to be_a GoogleDocsAtomEntry
|
30
32
|
end
|
31
33
|
end
|
@@ -1,82 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Feedjira::Parser::ITunesRSSItem do
|
4
|
-
before
|
6
|
+
before do
|
5
7
|
# I don't really like doing it this way because these unit test should only
|
6
8
|
# rely on ITunesRssItem, but this is actually how it should work. You would
|
7
9
|
# never just pass entry xml straight to the ITunesRssItem
|
8
10
|
@item = Feedjira::Parser::ITunesRSS.parse(sample_itunes_feed).entries.first
|
9
11
|
end
|
10
12
|
|
11
|
-
it "
|
13
|
+
it "parses the title" do
|
12
14
|
expect(@item.title).to eq "Shake Shake Shake Your Spices"
|
13
15
|
end
|
14
16
|
|
15
|
-
it "
|
17
|
+
it "parses the itunes title" do
|
16
18
|
expect(@item.itunes_title).to eq "Shake Shake Shake Your Spices"
|
17
19
|
end
|
18
20
|
|
19
|
-
it "
|
21
|
+
it "parses the author" do
|
20
22
|
expect(@item.itunes_author).to eq "John Doe"
|
21
23
|
end
|
22
24
|
|
23
|
-
it "
|
25
|
+
it "parses the subtitle" do
|
24
26
|
expect(@item.itunes_subtitle).to eq "A short primer on table spices"
|
25
27
|
end
|
26
28
|
|
27
|
-
it "
|
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!"
|
29
|
+
it "parses the summary" do
|
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
|
|
32
|
-
it "
|
34
|
+
it "parses the itunes season" do
|
33
35
|
expect(@item.itunes_season).to eq "1"
|
34
36
|
end
|
35
37
|
|
36
|
-
it "
|
38
|
+
it "parses the itunes episode number" do
|
37
39
|
expect(@item.itunes_episode).to eq "3"
|
38
40
|
end
|
39
41
|
|
40
|
-
it "
|
42
|
+
it "parses the itunes episode type" do
|
41
43
|
expect(@item.itunes_episode_type).to eq "full"
|
42
44
|
end
|
43
45
|
|
44
|
-
it "
|
46
|
+
it "parses the enclosure" do
|
45
47
|
expect(@item.enclosure_length).to eq "8727310"
|
46
48
|
expect(@item.enclosure_type).to eq "audio/x-m4a"
|
47
49
|
expect(@item.enclosure_url).to eq "http://example.com/podcasts/everything/AllAboutEverythingEpisode3.m4a"
|
48
50
|
end
|
49
51
|
|
50
|
-
it "
|
52
|
+
it "parses the guid as id" do
|
51
53
|
expect(@item.id).to eq "http://example.com/podcasts/archive/aae20050615.m4a"
|
52
54
|
end
|
53
55
|
|
54
|
-
it "
|
56
|
+
it "parses the published date" do
|
55
57
|
published = Time.parse_safely "Wed Jun 15 19:00:00 UTC 2005"
|
56
58
|
expect(@item.published).to eq published
|
57
59
|
end
|
58
60
|
|
59
|
-
it "
|
61
|
+
it "parses the duration" do
|
60
62
|
expect(@item.itunes_duration).to eq "7:04"
|
61
63
|
end
|
62
64
|
|
63
|
-
it "
|
65
|
+
it "parses the keywords" do
|
64
66
|
expect(@item.itunes_keywords).to eq "salt, pepper, shaker, exciting"
|
65
67
|
end
|
66
68
|
|
67
|
-
it "
|
69
|
+
it "parses the image" do
|
68
70
|
expect(@item.itunes_image).to eq "http://example.com/podcasts/everything/AllAboutEverything.jpg"
|
69
71
|
end
|
70
72
|
|
71
|
-
it "
|
73
|
+
it "parses the order" do
|
72
74
|
expect(@item.itunes_order).to eq "12"
|
73
75
|
end
|
74
76
|
|
75
|
-
it "
|
77
|
+
it "parses the closed captioned flag" do
|
76
78
|
expect(@item.itunes_closed_captioned).to eq "yes"
|
77
79
|
end
|
78
80
|
|
79
|
-
it "
|
81
|
+
it "parses the encoded content" do
|
80
82
|
content = "<p><strong>TOPIC</strong>: Gooseneck Options</p>"
|
81
83
|
expect(@item.content).to eq content
|
82
84
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Feedjira::Parser::ITunesRSSOwner do
|
4
|
-
before
|
6
|
+
before do
|
5
7
|
# I don't really like doing it this way because these unit test should only
|
6
8
|
# rely on RSSEntry, but this is actually how it should work. You would
|
7
9
|
# never just pass entry xml straight to the ITunesRssOwner
|
@@ -9,11 +11,11 @@ describe Feedjira::Parser::ITunesRSSOwner do
|
|
9
11
|
@owner = feed.itunes_owners.first
|
10
12
|
end
|
11
13
|
|
12
|
-
it "
|
14
|
+
it "parses the name" do
|
13
15
|
expect(@owner.name).to eq "John Doe"
|
14
16
|
end
|
15
17
|
|
16
|
-
it "
|
18
|
+
it "parses the email" do
|
17
19
|
expect(@owner.email).to eq "john.doe@example.com"
|
18
20
|
end
|
19
21
|
end
|