feedjira 2.2.0 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/feed-parsing.md +15 -0
  3. data/.rubocop.yml +32 -8
  4. data/.rubocop_todo.yml +11 -0
  5. data/.travis.yml +3 -7
  6. data/CHANGELOG.md +18 -9
  7. data/CODE_OF_CONDUCT.md +74 -0
  8. data/Gemfile +8 -5
  9. data/README.md +46 -99
  10. data/Rakefile +8 -6
  11. data/feedjira.gemspec +31 -20
  12. data/lib/feedjira.rb +75 -41
  13. data/lib/feedjira/atom_entry_utilities.rb +51 -0
  14. data/lib/feedjira/configuration.rb +8 -10
  15. data/lib/feedjira/core_ext.rb +5 -3
  16. data/lib/feedjira/core_ext/date.rb +2 -1
  17. data/lib/feedjira/core_ext/string.rb +2 -1
  18. data/lib/feedjira/core_ext/time.rb +12 -12
  19. data/lib/feedjira/date_time_utilities.rb +8 -10
  20. data/lib/feedjira/date_time_utilities/date_time_epoch_parser.rb +3 -2
  21. data/lib/feedjira/date_time_utilities/date_time_language_parser.rb +4 -4
  22. data/lib/feedjira/date_time_utilities/date_time_pattern_parser.rb +11 -15
  23. data/lib/feedjira/feed.rb +12 -82
  24. data/lib/feedjira/feed_entry_utilities.rb +14 -7
  25. data/lib/feedjira/feed_utilities.rb +5 -4
  26. data/lib/feedjira/parser.rb +6 -1
  27. data/lib/feedjira/parser/atom.rb +6 -5
  28. data/lib/feedjira/parser/atom_entry.rb +4 -21
  29. data/lib/feedjira/parser/atom_feed_burner.rb +7 -6
  30. data/lib/feedjira/parser/atom_feed_burner_entry.rb +7 -18
  31. data/lib/feedjira/parser/atom_google_alerts.rb +26 -0
  32. data/lib/feedjira/parser/atom_google_alerts_entry.rb +21 -0
  33. data/lib/feedjira/parser/atom_youtube.rb +4 -3
  34. data/lib/feedjira/parser/atom_youtube_entry.rb +9 -8
  35. data/lib/feedjira/parser/globally_unique_identifier.rb +21 -0
  36. data/lib/feedjira/parser/google_docs_atom.rb +6 -6
  37. data/lib/feedjira/parser/google_docs_atom_entry.rb +3 -19
  38. data/lib/feedjira/parser/itunes_rss.rb +4 -3
  39. data/lib/feedjira/parser/itunes_rss_category.rb +6 -5
  40. data/lib/feedjira/parser/itunes_rss_item.rb +5 -8
  41. data/lib/feedjira/parser/itunes_rss_owner.rb +2 -1
  42. data/lib/feedjira/parser/json_feed.rb +41 -0
  43. data/lib/feedjira/parser/json_feed_item.rb +57 -0
  44. data/lib/feedjira/parser/podlove_chapter.rb +4 -3
  45. data/lib/feedjira/parser/rss.rb +5 -3
  46. data/lib/feedjira/parser/rss_entry.rb +3 -24
  47. data/lib/feedjira/parser/rss_feed_burner.rb +4 -3
  48. data/lib/feedjira/parser/rss_feed_burner_entry.rb +6 -26
  49. data/lib/feedjira/parser/rss_image.rb +2 -0
  50. data/lib/feedjira/preprocessor.rb +4 -4
  51. data/lib/feedjira/rss_entry_utilities.rb +53 -0
  52. data/lib/feedjira/version.rb +3 -1
  53. data/spec/feedjira/configuration_spec.rb +11 -16
  54. data/spec/feedjira/date_time_utilities_spec.rb +22 -20
  55. data/spec/feedjira/feed_entry_utilities_spec.rb +20 -18
  56. data/spec/feedjira/feed_spec.rb +17 -229
  57. data/spec/feedjira/feed_utilities_spec.rb +75 -73
  58. data/spec/feedjira/parser/atom_entry_spec.rb +41 -38
  59. data/spec/feedjira/parser/atom_feed_burner_entry_spec.rb +22 -20
  60. data/spec/feedjira/parser/atom_feed_burner_spec.rb +122 -118
  61. data/spec/feedjira/parser/atom_google_alerts_entry_spec.rb +34 -0
  62. data/spec/feedjira/parser/atom_google_alerts_spec.rb +62 -0
  63. data/spec/feedjira/parser/atom_spec.rb +83 -77
  64. data/spec/feedjira/parser/atom_youtube_entry_spec.rb +41 -39
  65. data/spec/feedjira/parser/atom_youtube_spec.rb +21 -19
  66. data/spec/feedjira/parser/google_docs_atom_entry_spec.rb +10 -8
  67. data/spec/feedjira/parser/google_docs_atom_spec.rb +25 -21
  68. data/spec/feedjira/parser/itunes_rss_item_spec.rb +39 -37
  69. data/spec/feedjira/parser/itunes_rss_owner_spec.rb +7 -5
  70. data/spec/feedjira/parser/itunes_rss_spec.rb +120 -116
  71. data/spec/feedjira/parser/json_feed_item_spec.rb +81 -0
  72. data/spec/feedjira/parser/json_feed_spec.rb +55 -0
  73. data/spec/feedjira/parser/podlove_chapter_spec.rb +14 -12
  74. data/spec/feedjira/parser/rss_entry_spec.rb +56 -34
  75. data/spec/feedjira/parser/rss_feed_burner_entry_spec.rb +36 -34
  76. data/spec/feedjira/parser/rss_feed_burner_spec.rb +49 -45
  77. data/spec/feedjira/parser/rss_spec.rb +38 -36
  78. data/spec/feedjira/preprocessor_spec.rb +9 -7
  79. data/spec/feedjira_spec.rb +166 -0
  80. data/spec/sample_feeds.rb +32 -29
  81. data/spec/sample_feeds/HuffPostCanada.xml +279 -0
  82. data/spec/sample_feeds/Permalinks.xml +22 -0
  83. data/spec/sample_feeds/a10.xml +72 -0
  84. data/spec/sample_feeds/google_alerts_atom.xml +1 -0
  85. data/spec/sample_feeds/json_feed.json +156 -0
  86. data/spec/spec_helper.rb +7 -5
  87. metadata +59 -70
  88. data/Dangerfile +0 -1
  89. data/fixtures/vcr_cassettes/fetch_failure.yml +0 -62
  90. data/fixtures/vcr_cassettes/parse_error.yml +0 -222
  91. data/fixtures/vcr_cassettes/success.yml +0 -281
@@ -1,4 +1,6 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
2
4
 
3
5
  describe Feedjira::FeedUtilities do
4
6
  before(:each) do
@@ -8,17 +10,17 @@ describe Feedjira::FeedUtilities do
8
10
  end
9
11
  end
10
12
 
11
- describe 'preprocessing' do
12
- context 'when the flag is not set' do
13
- it 'does not call the preprocessing method' do
13
+ describe "preprocessing" do
14
+ context "when the flag is not set" do
15
+ it "does not call the preprocessing method" do
14
16
  @klass.preprocess_xml = false
15
17
  expect(@klass).to_not receive :preprocess
16
18
  @klass.parse sample_rss_feed
17
19
  end
18
20
  end
19
21
 
20
- context 'when the flag is set' do
21
- it 'calls the preprocessing method' do
22
+ context "when the flag is set" do
23
+ it "calls the preprocessing method" do
22
24
  @klass.preprocess_xml = true
23
25
  expect(@klass).to receive(:preprocess).and_return sample_rss_feed
24
26
  @klass.parse sample_rss_feed
@@ -26,46 +28,46 @@ describe Feedjira::FeedUtilities do
26
28
  end
27
29
  end
28
30
 
29
- describe 'strip whitespace' do
30
- context 'strip_whitespace config is true' do
31
- it 'strips all XML whitespace' do
31
+ describe "strip whitespace" do
32
+ context "strip_whitespace config is true" do
33
+ it "strips all XML whitespace" do
32
34
  Feedjira.configure { |config| config.strip_whitespace = true }
33
35
 
34
- expect(@klass.strip_whitespace("\nfoobar\n")).to eq('foobar')
36
+ expect(@klass.strip_whitespace("\nfoobar\n")).to eq("foobar")
35
37
 
36
38
  Feedjira.configure { |config| config.strip_whitespace = false }
37
39
  end
38
40
  end
39
41
 
40
- context 'strip_whitespace config is false' do
41
- it 'lstrips XML whitespace' do
42
+ context "strip_whitespace config is false" do
43
+ it "lstrips XML whitespace" do
42
44
  expect(@klass.strip_whitespace("\nfoobar\n")).to eq("foobar\n")
43
45
  end
44
46
  end
45
47
  end
46
48
 
47
- describe 'instance methods' do
48
- it 'should provide an updated? accessor' do
49
+ describe "instance methods" do
50
+ it "should provide an updated? accessor" do
49
51
  feed = @klass.new
50
52
  expect(feed).to_not be_updated
51
53
  feed.updated = true
52
54
  expect(feed).to be_updated
53
55
  end
54
56
 
55
- it 'should provide a new_entries accessor' do
57
+ it "should provide a new_entries accessor" do
56
58
  feed = @klass.new
57
59
  expect(feed.new_entries).to eq []
58
60
  feed.new_entries = [:foo]
59
61
  expect(feed.new_entries).to eq [:foo]
60
62
  end
61
63
 
62
- it 'should provide an etag accessor' do
64
+ it "should provide an etag accessor" do
63
65
  feed = @klass.new
64
- feed.etag = 'foo'
65
- expect(feed.etag).to eq 'foo'
66
+ feed.etag = "foo"
67
+ expect(feed.etag).to eq "foo"
66
68
  end
67
69
 
68
- it 'should provide a last_modified accessor' do
70
+ it "should provide a last_modified accessor" do
69
71
  feed = @klass.new
70
72
  time = Time.now
71
73
  feed.last_modified = time
@@ -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 # rubocop:disable Metrics/LineLength
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 # rubocop:disable Metrics/LineLength
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 # rubocop:disable Metrics/LineLength
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
@@ -97,99 +99,99 @@ describe Feedjira::FeedUtilities do
97
99
  end
98
100
  end
99
101
 
100
- describe '#update_from_feed' do
101
- describe 'updating feed attributes' do
102
+ describe "#update_from_feed" do
103
+ describe "updating feed attributes" do
102
104
  before(:each) do
103
105
  # I'm using the Atom class when I know I should be using a different
104
106
  # one. However, this update_from_feed method would only be called
105
107
  # against a feed item.
106
108
  @feed = Feedjira::Parser::Atom.new
107
- @feed.title = 'A title'
108
- @feed.url = 'http://pauldix.net'
109
- @feed.feed_url = 'http://feeds.feedburner.com/PaulDixExplainsNothing'
109
+ @feed.title = "A title"
110
+ @feed.url = "http://pauldix.net"
111
+ @feed.feed_url = "http://feeds.feedburner.com/PaulDixExplainsNothing"
110
112
  @feed.updated = false
111
113
  @updated_feed = @feed.dup
112
114
  end
113
115
 
114
- it 'should update the title if changed' do
115
- @updated_feed.title = 'new title'
116
+ it "should update the title if changed" do
117
+ @updated_feed.title = "new title"
116
118
  @feed.update_from_feed(@updated_feed)
117
119
  expect(@feed.title).to eq @updated_feed.title
118
120
  expect(@feed).to be_updated
119
121
  end
120
122
 
121
- it 'should not update the title if the same' do
123
+ it "should not update the title if the same" do
122
124
  @feed.update_from_feed(@updated_feed)
123
125
  expect(@feed).to_not be_updated
124
126
  end
125
127
 
126
- it 'should update the feed_url if changed' do
127
- @updated_feed.feed_url = 'a new feed url'
128
+ it "should update the feed_url if changed" do
129
+ @updated_feed.feed_url = "a new feed url"
128
130
  @feed.update_from_feed(@updated_feed)
129
131
  expect(@feed.feed_url).to eq @updated_feed.feed_url
130
132
  expect(@feed).to be_updated
131
133
  end
132
134
 
133
- it 'should not update the feed_url if the same' do
135
+ it "should not update the feed_url if the same" do
134
136
  @feed.update_from_feed(@updated_feed)
135
137
  expect(@feed).to_not be_updated
136
138
  end
137
139
 
138
- it 'should update the url if changed' do
139
- @updated_feed.url = 'a new url'
140
+ it "should update the url if changed" do
141
+ @updated_feed.url = "a new url"
140
142
  @feed.update_from_feed(@updated_feed)
141
143
  expect(@feed.url).to eq @updated_feed.url
142
144
  end
143
145
 
144
- it 'should not update the url if not changed' do
146
+ it "should not update the url if not changed" do
145
147
  @feed.update_from_feed(@updated_feed)
146
148
  expect(@feed).to_not be_updated
147
149
  end
148
150
  end
149
151
 
150
- describe 'updating entries' do
152
+ describe "updating entries" do
151
153
  before(:each) do
152
154
  # I'm using the Atom class when I know I should be using a different
153
155
  # one. However, this update_from_feed method would only be called
154
156
  # against a feed item.
155
157
  @feed = Feedjira::Parser::Atom.new
156
- @feed.title = 'A title'
157
- @feed.url = 'http://pauldix.net'
158
- @feed.feed_url = 'http://feeds.feedburner.com/PaulDixExplainsNothing'
158
+ @feed.title = "A title"
159
+ @feed.url = "http://pauldix.net"
160
+ @feed.feed_url = "http://feeds.feedburner.com/PaulDixExplainsNothing"
159
161
  @feed.updated = false
160
162
  @updated_feed = @feed.dup
161
163
  @old_entry = Feedjira::Parser::AtomEntry.new
162
- @old_entry.url = 'http://pauldix.net/old.html'
164
+ @old_entry.url = "http://pauldix.net/old.html"
163
165
  @old_entry.published = Time.now.to_s
164
- @old_entry.entry_id = 'entry_id_old'
166
+ @old_entry.entry_id = "entry_id_old"
165
167
  @new_entry = Feedjira::Parser::AtomEntry.new
166
- @new_entry.url = 'http://pauldix.net/new.html'
168
+ @new_entry.url = "http://pauldix.net/new.html"
167
169
  @new_entry.published = (Time.now + 10).to_s
168
- @new_entry.entry_id = 'entry_id_new'
170
+ @new_entry.entry_id = "entry_id_new"
169
171
  @feed.entries << @old_entry
170
172
  @updated_feed.entries << @new_entry
171
173
  @updated_feed.entries << @old_entry
172
174
  end
173
175
 
174
- it 'should update last-modified from the latest entry date' do
176
+ it "should update last-modified from the latest entry date" do
175
177
  @feed.update_from_feed(@updated_feed)
176
178
  expect(@feed.last_modified).to eq @new_entry.published
177
179
  end
178
180
 
179
- it 'should put new entries into new_entries' do
181
+ it "should put new entries into new_entries" do
180
182
  @feed.update_from_feed(@updated_feed)
181
183
  expect(@feed.new_entries).to eq [@new_entry]
182
184
  end
183
185
 
184
- it 'should also put new entries into the entries collection' do
186
+ it "should also put new entries into the entries collection" do
185
187
  @feed.update_from_feed(@updated_feed)
186
188
  expect(@feed.entries).to include(@new_entry)
187
189
  expect(@feed.entries).to include(@old_entry)
188
190
  end
189
191
  end
190
192
 
191
- describe '#update_from_feed' do
192
- let(:recent_entry_id) { 'entry_id' }
193
+ describe "#update_from_feed" do
194
+ let(:recent_entry_id) { "entry_id" }
193
195
  let(:old_entry_id) { nil }
194
196
 
195
197
  before(:each) do
@@ -197,25 +199,25 @@ describe Feedjira::FeedUtilities do
197
199
  # one. However, this update_from_feed method would only be called
198
200
  # against a feed item.
199
201
  @feed = Feedjira::Parser::Atom.new
200
- @feed.title = 'A title'
201
- @feed.url = 'http://pauldix.net'
202
- @feed.feed_url = 'http://feeds.feedburner.com/PaulDixExplainsNothing'
202
+ @feed.title = "A title"
203
+ @feed.url = "http://pauldix.net"
204
+ @feed.feed_url = "http://feeds.feedburner.com/PaulDixExplainsNothing"
203
205
  @feed.updated = false
204
206
  @updated_feed = @feed.dup
205
207
 
206
208
  @old_entry = Feedjira::Parser::AtomEntry.new
207
- @old_entry.url = 'http://pauldix.net/old.html'
209
+ @old_entry.url = "http://pauldix.net/old.html"
208
210
  @old_entry.entry_id = old_entry_id
209
211
  @old_entry.published = (Time.now - 10).to_s
210
212
 
211
213
  @entry = Feedjira::Parser::AtomEntry.new
212
214
  @entry.published = (Time.now + 10).to_s
213
215
  @entry.entry_id = recent_entry_id
214
- @entry.url = 'http://pauldix.net/entry.html'
216
+ @entry.url = "http://pauldix.net/entry.html"
215
217
 
216
218
  # only difference is a changed url
217
219
  @entry_changed_url = @entry.dup
218
- @entry_changed_url.url = 'http://pauldix.net/updated.html'
220
+ @entry_changed_url.url = "http://pauldix.net/updated.html"
219
221
 
220
222
  # entry with changed url must be first
221
223
  @feed.entries << @entry
@@ -224,8 +226,8 @@ describe Feedjira::FeedUtilities do
224
226
  @updated_feed.entries << @old_entry
225
227
  end
226
228
 
227
- context 'changing the url of an existing entry' do
228
- it 'should not put the complete feed into new_entries' do
229
+ context "changing the url of an existing entry" do
230
+ it "should not put the complete feed into new_entries" do
229
231
  @feed.update_from_feed(@updated_feed)
230
232
  expect(@feed.new_entries).to_not include(@entry_changed_url)
231
233
  expect(@feed.new_entries).to_not include(@old_entry)
@@ -234,11 +236,11 @@ describe Feedjira::FeedUtilities do
234
236
  end
235
237
  end
236
238
 
237
- context 'feed not have entry id and only difference is a url' do
239
+ context "feed not have entry id and only difference is a url" do
238
240
  let(:recent_entry_id) { nil }
239
241
  let(:old_entry_id) { nil }
240
242
 
241
- it 'should put the complete feed into new_entries' do
243
+ it "should put the complete feed into new_entries" do
242
244
  @feed.update_from_feed(@updated_feed)
243
245
  expect(@feed.new_entries).to include(@entry_changed_url)
244
246
  expect(@feed.new_entries).to include(@old_entry)
@@ -248,42 +250,42 @@ describe Feedjira::FeedUtilities do
248
250
  end
249
251
  end
250
252
 
251
- describe 'updating with a feed' do
252
- let(:id_one) { '1' }
253
- let(:id_two) { '2' }
253
+ describe "updating with a feed" do
254
+ let(:id_one) { "1" }
255
+ let(:id_two) { "2" }
254
256
 
255
- let(:url_one) { 'http://example.com/post_one.html' }
256
- let(:url_two) { 'http://example.com/post_two.html' }
257
+ let(:url_one) { "http://example.com/post_one.html" }
258
+ let(:url_two) { "http://example.com/post_two.html" }
257
259
 
258
- let(:entry_one) { double 'Entry One', entry_id: id_one, url: url_one }
259
- let(:entry_two) { double 'Entry Two', entry_id: id_two, url: url_two }
260
+ let(:entry_one) { double "Entry One", entry_id: id_one, url: url_one }
261
+ let(:entry_two) { double "Entry Two", entry_id: id_two, url: url_two }
260
262
 
261
263
  let(:feed_one) { Feedjira::Parser::Atom.new }
262
- let(:feed_two) { double 'Feed Two', entries: [entry_two] }
264
+ let(:feed_two) { double "Feed Two", entries: [entry_two] }
263
265
 
264
266
  before do
265
- stub_const('Feedjira::FeedUtilities::UPDATABLE_ATTRIBUTES', [])
267
+ stub_const("Feedjira::FeedUtilities::UPDATABLE_ATTRIBUTES", [])
266
268
  feed_one.entries << entry_one
267
269
  end
268
270
 
269
- it 'finds entries with unique ids and urls' do
271
+ it "finds entries with unique ids and urls" do
270
272
  feed_one.update_from_feed feed_two
271
273
  expect(feed_one.new_entries).to eq [entry_two]
272
274
  end
273
275
 
274
- context 'when the entries have the same id' do
276
+ context "when the entries have the same id" do
275
277
  let(:id_two) { id_one }
276
278
 
277
- it 'does not find a new entry' do
279
+ it "does not find a new entry" do
278
280
  feed_one.update_from_feed feed_two
279
281
  expect(feed_one.new_entries).to eq []
280
282
  end
281
283
  end
282
284
 
283
- context 'when the entries have the same url' do
285
+ context "when the entries have the same url" do
284
286
  let(:url_two) { url_one }
285
287
 
286
- it 'does not find a new entry' do
288
+ it "does not find a new entry" do
287
289
  feed_one.update_from_feed feed_two
288
290
  expect(feed_one.new_entries).to eq []
289
291
  end
@@ -1,4 +1,6 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
2
4
 
3
5
  describe Feedjira::Parser::AtomEntry do
4
6
  before(:each) do
@@ -8,68 +10,68 @@ describe Feedjira::Parser::AtomEntry do
8
10
  @entry = Feedjira::Parser::Atom.parse(sample_atom_feed).entries.first
9
11
  end
10
12
 
11
- it 'should parse the title' do
12
- title = 'AWS Job: Architect & Designer Position in Turkey'
13
+ it "should parse the title" do
14
+ title = "AWS Job: Architect & Designer Position in Turkey"
13
15
  expect(@entry.title).to eq title
14
16
  end
15
17
 
16
- it 'should parse the url' do
17
- expect(@entry.url).to eq 'http://aws.typepad.com/aws/2009/01/aws-job-architect-designer-position-in-turkey.html'
18
+ it "should parse the url" do
19
+ expect(@entry.url).to eq "http://aws.typepad.com/aws/2009/01/aws-job-architect-designer-position-in-turkey.html"
18
20
  end
19
21
 
20
- it 'should parse the url even when' do
21
- xml = load_sample('atom_with_link_tag_for_url_unmarked.xml')
22
+ it "should parse the url even when" do
23
+ xml = load_sample("atom_with_link_tag_for_url_unmarked.xml")
22
24
  entries = Feedjira::Parser::Atom.parse(xml).entries
23
- expect(entries.first.url).to eq 'http://www.innoq.com/blog/phaus/2009/07/ja.html'
25
+ expect(entries.first.url).to eq "http://www.innoq.com/blog/phaus/2009/07/ja.html"
24
26
  end
25
27
 
26
- it 'should parse the author' do
27
- expect(@entry.author).to eq 'AWS Editor'
28
+ it "should parse the author" do
29
+ expect(@entry.author).to eq "AWS Editor"
28
30
  end
29
31
 
30
- it 'should parse the content' do
32
+ it "should parse the content" do
31
33
  expect(@entry.content).to eq sample_atom_entry_content
32
34
  end
33
35
 
34
- 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..." # rubocop:disable Metrics/LineLength
36
+ it "should provide a summary" do
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
 
39
- it 'should parse the published date' do
40
- published = Time.parse_safely 'Fri Jan 16 18:21:00 UTC 2009'
41
+ it "should parse the published date" do
42
+ published = Time.parse_safely "Fri Jan 16 18:21:00 UTC 2009"
41
43
  expect(@entry.published).to eq published
42
44
  end
43
45
 
44
- it 'should parse the categories' do
45
- expect(@entry.categories).to eq %w(Turkey Seattle)
46
+ it "should parse the categories" do
47
+ expect(@entry.categories).to eq %w[Turkey Seattle]
46
48
  end
47
49
 
48
- it 'should parse the updated date' do
49
- updated = Time.parse_safely 'Fri Jan 16 18:21:00 UTC 2009'
50
+ it "should parse the updated date" do
51
+ updated = Time.parse_safely "Fri Jan 16 18:21:00 UTC 2009"
50
52
  expect(@entry.updated).to eq updated
51
53
  end
52
54
 
53
- it 'should parse the id' do
54
- expect(@entry.id).to eq 'tag:typepad.com,2003:post-61484736'
55
+ it "should parse the id" do
56
+ expect(@entry.id).to eq "tag:typepad.com,2003:post-61484736"
55
57
  end
56
58
 
57
- it 'should support each' do
59
+ it "should support each" do
58
60
  expect(@entry).to respond_to :each
59
61
  end
60
62
 
61
- it 'should be able to list out all fields with each' do
63
+ it "should be able to list out all fields with each" do
62
64
  all_fields = []
63
- title_value = ''
65
+ title_value = ""
64
66
 
65
67
  @entry.each do |field, value|
66
68
  all_fields << field
67
- title_value = value if field == 'title'
69
+ title_value = value if field == "title"
68
70
  end
69
71
 
70
- expect(title_value).to eq 'AWS Job: Architect & Designer Position in Turkey'
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,25 +80,26 @@ 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
 
87
- it 'should support checking if a field exists in the entry' do
88
- expect(@entry).to include 'author'
89
- expect(@entry).to include 'title'
90
+ it "should support checking if a field exists in the entry" do
91
+ expect(@entry).to include "author"
92
+ expect(@entry).to include "title"
90
93
  end
91
94
 
92
- it 'should allow access to fields with hash syntax' do
93
- title = 'AWS Job: Architect & Designer Position in Turkey'
94
- expect(@entry['title']).to eq title
95
- expect(@entry['author']).to eq 'AWS Editor'
95
+ it "should allow access to fields with hash syntax" do
96
+ title = "AWS Job: Architect & Designer Position in Turkey"
97
+ expect(@entry["title"]).to eq title
98
+ expect(@entry["author"]).to eq "AWS Editor"
96
99
  end
97
100
 
98
- it 'should allow setting field values with hash syntax' do
99
- @entry['title'] = 'Foobar'
100
- expect(@entry.title).to eq 'Foobar'
101
+ it "should allow setting field values with hash syntax" do
102
+ @entry["title"] = "Foobar"
103
+ expect(@entry.title).to eq "Foobar"
101
104
  end
102
105
  end