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