feedjira 3.2.0 → 3.2.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/general-issue.md +8 -0
- data/.github/workflows/ruby.yml +1 -1
- data/.rubocop.yml +33 -1
- data/CHANGELOG.md +13 -0
- data/Gemfile +0 -3
- data/README.md +1 -2
- data/feedjira.gemspec +7 -3
- data/lib/feedjira/core_ext/date.rb +3 -2
- 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/rss_entry_utilities.rb +5 -1
- 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} +8 -8
- data/spec/feedjira/{feed_entry_utilities_spec.rb → feed_utilities_entry_spec.rb} +9 -9
- data/spec/feedjira/feed_utilities_spec.rb +37 -42
- 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 +14 -14
- data/spec/feedjira/parser/podlove_chapter_spec.rb +7 -7
- data/spec/feedjira/parser/rss_entry_spec.rb +26 -20
- data/spec/feedjira/parser/rss_feed_burner_entry_spec.rb +16 -15
- data/spec/feedjira/parser/rss_feed_burner_spec.rb +17 -17
- data/spec/feedjira/parser/rss_spec.rb +25 -25
- data/spec/feedjira/preprocessor_spec.rb +3 -3
- data/spec/feedjira_spec.rb +41 -41
- data/spec/sample_feeds/RSSWithComments.xml +277 -0
- data/spec/sample_feeds.rb +2 -1
- metadata +68 -77
@@ -3,7 +3,7 @@
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
5
|
describe Feedjira::FeedUtilities do
|
6
|
-
before
|
6
|
+
before do
|
7
7
|
@klass = Class.new do
|
8
8
|
include SAXMachine
|
9
9
|
include Feedjira::FeedUtilities
|
@@ -14,22 +14,22 @@ describe Feedjira::FeedUtilities do
|
|
14
14
|
context "when the flag is not set" do
|
15
15
|
it "does not call the preprocessing method" do
|
16
16
|
@klass.preprocess_xml = false
|
17
|
-
expect(@klass).
|
17
|
+
expect(@klass).not_to receive :preprocess
|
18
18
|
@klass.parse sample_rss_feed
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
context "when the flag is set" do
|
23
|
-
it "calls the preprocessing method" do
|
23
|
+
it "calls the preprocessing method" do # rubocop:todo RSpec/NoExpectationExample
|
24
24
|
@klass.preprocess_xml = true
|
25
|
-
|
25
|
+
allow(@klass).to receive(:preprocess).and_return sample_rss_feed
|
26
26
|
@klass.parse sample_rss_feed
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe "strip whitespace" do
|
32
|
-
context "strip_whitespace config is true" do
|
31
|
+
describe "when configured to strip whitespace" do
|
32
|
+
context "when strip_whitespace config is true" do
|
33
33
|
it "strips all XML whitespace" do
|
34
34
|
Feedjira.configure { |config| config.strip_whitespace = true }
|
35
35
|
|
@@ -39,7 +39,7 @@ describe Feedjira::FeedUtilities do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
context "strip_whitespace
|
42
|
+
context "when strip_whitespace is configured false" do
|
43
43
|
it "lstrips XML whitespace" do
|
44
44
|
expect(@klass.strip_whitespace("\nfoobar\n")).to eq("foobar\n")
|
45
45
|
end
|
@@ -47,27 +47,27 @@ describe Feedjira::FeedUtilities do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "instance methods" do
|
50
|
-
it "
|
50
|
+
it "provides an updated? accessor" do
|
51
51
|
feed = @klass.new
|
52
|
-
expect(feed).
|
52
|
+
expect(feed).not_to be_updated
|
53
53
|
feed.updated = true
|
54
54
|
expect(feed).to be_updated
|
55
55
|
end
|
56
56
|
|
57
|
-
it "
|
57
|
+
it "provides a new_entries accessor" do
|
58
58
|
feed = @klass.new
|
59
59
|
expect(feed.new_entries).to eq []
|
60
60
|
feed.new_entries = [:foo]
|
61
61
|
expect(feed.new_entries).to eq [:foo]
|
62
62
|
end
|
63
63
|
|
64
|
-
it "
|
64
|
+
it "provides an etag accessor" do
|
65
65
|
feed = @klass.new
|
66
66
|
feed.etag = "foo"
|
67
67
|
expect(feed.etag).to eq "foo"
|
68
68
|
end
|
69
69
|
|
70
|
-
it "
|
70
|
+
it "provides a last_modified accessor" do
|
71
71
|
feed = @klass.new
|
72
72
|
time = Time.now
|
73
73
|
feed.last_modified = time
|
@@ -75,13 +75,13 @@ describe Feedjira::FeedUtilities do
|
|
75
75
|
expect(feed.last_modified.class).to eq Time
|
76
76
|
end
|
77
77
|
|
78
|
-
it "
|
78
|
+
it "returns new_entries? as true when entries are put into new_entries" do
|
79
79
|
feed = @klass.new
|
80
80
|
feed.new_entries << :foo
|
81
|
-
expect(feed.new_entries?).to
|
81
|
+
expect(feed.new_entries?).to be true
|
82
82
|
end
|
83
83
|
|
84
|
-
it "
|
84
|
+
it "returns a last_modified value from the entry with the most recent published date if the last_modified date hasn't been set" do
|
85
85
|
feed = Feedjira::Parser::Atom.new
|
86
86
|
entry = Feedjira::Parser::AtomEntry.new
|
87
87
|
entry.published = Time.now.to_s
|
@@ -89,7 +89,7 @@ describe Feedjira::FeedUtilities do
|
|
89
89
|
expect(feed.last_modified).to eq entry.published
|
90
90
|
end
|
91
91
|
|
92
|
-
it "
|
92
|
+
it "does not throw an error if one of the entries has published date of nil" do
|
93
93
|
feed = Feedjira::Parser::Atom.new
|
94
94
|
entry = Feedjira::Parser::AtomEntry.new
|
95
95
|
entry.published = Time.now.to_s
|
@@ -101,7 +101,7 @@ describe Feedjira::FeedUtilities do
|
|
101
101
|
|
102
102
|
describe "#update_from_feed" do
|
103
103
|
describe "updating feed attributes" do
|
104
|
-
before
|
104
|
+
before do
|
105
105
|
# I'm using the Atom class when I know I should be using a different
|
106
106
|
# one. However, this update_from_feed method would only be called
|
107
107
|
# against a feed item.
|
@@ -113,44 +113,39 @@ describe Feedjira::FeedUtilities do
|
|
113
113
|
@updated_feed = @feed.dup
|
114
114
|
end
|
115
115
|
|
116
|
-
it "
|
116
|
+
it "updates the title if changed" do
|
117
117
|
@updated_feed.title = "new title"
|
118
118
|
@feed.update_from_feed(@updated_feed)
|
119
119
|
expect(@feed.title).to eq @updated_feed.title
|
120
120
|
expect(@feed).to be_updated
|
121
121
|
end
|
122
122
|
|
123
|
-
it "
|
123
|
+
it "does not update the title if the same" do
|
124
124
|
@feed.update_from_feed(@updated_feed)
|
125
|
-
expect(@feed).
|
125
|
+
expect(@feed).not_to be_updated
|
126
126
|
end
|
127
127
|
|
128
|
-
it "
|
128
|
+
it "updates the feed_url if changed" do
|
129
129
|
@updated_feed.feed_url = "a new feed url"
|
130
130
|
@feed.update_from_feed(@updated_feed)
|
131
131
|
expect(@feed.feed_url).to eq @updated_feed.feed_url
|
132
132
|
expect(@feed).to be_updated
|
133
133
|
end
|
134
134
|
|
135
|
-
it "
|
136
|
-
@feed.update_from_feed(@updated_feed)
|
137
|
-
expect(@feed).to_not be_updated
|
138
|
-
end
|
139
|
-
|
140
|
-
it "should update the url if changed" do
|
135
|
+
it "updates the url if changed" do
|
141
136
|
@updated_feed.url = "a new url"
|
142
137
|
@feed.update_from_feed(@updated_feed)
|
143
138
|
expect(@feed.url).to eq @updated_feed.url
|
144
139
|
end
|
145
140
|
|
146
|
-
it "
|
141
|
+
it "does not update the url if not changed" do
|
147
142
|
@feed.update_from_feed(@updated_feed)
|
148
|
-
expect(@feed).
|
143
|
+
expect(@feed).not_to be_updated
|
149
144
|
end
|
150
145
|
end
|
151
146
|
|
152
147
|
describe "updating entries" do
|
153
|
-
before
|
148
|
+
before do
|
154
149
|
# I'm using the Atom class when I know I should be using a different
|
155
150
|
# one. However, this update_from_feed method would only be called
|
156
151
|
# against a feed item.
|
@@ -173,17 +168,17 @@ describe Feedjira::FeedUtilities do
|
|
173
168
|
@updated_feed.entries << @old_entry
|
174
169
|
end
|
175
170
|
|
176
|
-
it "
|
171
|
+
it "updates last-modified from the latest entry date" do
|
177
172
|
@feed.update_from_feed(@updated_feed)
|
178
173
|
expect(@feed.last_modified).to eq @new_entry.published
|
179
174
|
end
|
180
175
|
|
181
|
-
it "
|
176
|
+
it "puts new entries into new_entries" do
|
182
177
|
@feed.update_from_feed(@updated_feed)
|
183
178
|
expect(@feed.new_entries).to eq [@new_entry]
|
184
179
|
end
|
185
180
|
|
186
|
-
it "
|
181
|
+
it "alsoes put new entries into the entries collection" do
|
187
182
|
@feed.update_from_feed(@updated_feed)
|
188
183
|
expect(@feed.entries).to include(@new_entry)
|
189
184
|
expect(@feed.entries).to include(@old_entry)
|
@@ -194,7 +189,7 @@ describe Feedjira::FeedUtilities do
|
|
194
189
|
let(:recent_entry_id) { "entry_id" }
|
195
190
|
let(:old_entry_id) { nil }
|
196
191
|
|
197
|
-
before
|
192
|
+
before do
|
198
193
|
# I'm using the Atom class when I know I should be using a different
|
199
194
|
# one. However, this update_from_feed method would only be called
|
200
195
|
# against a feed item.
|
@@ -226,26 +221,26 @@ describe Feedjira::FeedUtilities do
|
|
226
221
|
@updated_feed.entries << @old_entry
|
227
222
|
end
|
228
223
|
|
229
|
-
context "changing the url of an existing entry" do
|
230
|
-
it "
|
224
|
+
context "when changing the url of an existing entry" do
|
225
|
+
it "does not put the complete feed into new_entries" do
|
231
226
|
@feed.update_from_feed(@updated_feed)
|
232
|
-
expect(@feed.new_entries).
|
233
|
-
expect(@feed.new_entries).
|
227
|
+
expect(@feed.new_entries).not_to include(@entry_changed_url)
|
228
|
+
expect(@feed.new_entries).not_to include(@old_entry)
|
234
229
|
expect(@feed.new_entries.size).to eq 0
|
235
|
-
expect(@feed.new_entries.size).
|
230
|
+
expect(@feed.new_entries.size).not_to eq 2
|
236
231
|
end
|
237
232
|
end
|
238
233
|
|
239
|
-
context "feed not have entry id and only difference is a url" do
|
234
|
+
context "when feed does not have entry id and only difference is a url" do
|
240
235
|
let(:recent_entry_id) { nil }
|
241
236
|
let(:old_entry_id) { nil }
|
242
237
|
|
243
|
-
it "
|
238
|
+
it "puts the complete feed into new_entries" do
|
244
239
|
@feed.update_from_feed(@updated_feed)
|
245
240
|
expect(@feed.new_entries).to include(@entry_changed_url)
|
246
241
|
expect(@feed.new_entries).to include(@old_entry)
|
247
242
|
expect(@feed.new_entries.size).to eq 2
|
248
|
-
expect(@feed.new_entries.size).
|
243
|
+
expect(@feed.new_entries.size).not_to eq 0
|
249
244
|
end
|
250
245
|
end
|
251
246
|
end
|
@@ -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
|