rss 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS.md +38 -0
  3. data/README.md +11 -11
  4. data/lib/rss/itunes.rb +10 -1
  5. data/lib/rss/maker/itunes.rb +2 -0
  6. data/lib/rss/rss.rb +43 -15
  7. data/lib/rss/utils.rb +0 -18
  8. data/lib/rss/version.rb +1 -1
  9. data/lib/rss/xml-stylesheet.rb +3 -4
  10. data/lib/rss/xml.rb +3 -2
  11. data/lib/rss.rb +11 -11
  12. metadata +7 -101
  13. data/Gemfile +0 -6
  14. data/Rakefile +0 -15
  15. data/rss.gemspec +0 -30
  16. data/test/dot.png +0 -0
  17. data/test/rss-assertions.rb +0 -2116
  18. data/test/rss-testcase.rb +0 -479
  19. data/test/run-test.rb +0 -15
  20. data/test/test_1.0.rb +0 -308
  21. data/test/test_2.0.rb +0 -412
  22. data/test/test_accessor.rb +0 -104
  23. data/test/test_atom.rb +0 -684
  24. data/test/test_content.rb +0 -105
  25. data/test/test_dublincore.rb +0 -270
  26. data/test/test_image.rb +0 -215
  27. data/test/test_inherit.rb +0 -41
  28. data/test/test_itunes.rb +0 -360
  29. data/test/test_maker_0.9.rb +0 -477
  30. data/test/test_maker_1.0.rb +0 -519
  31. data/test/test_maker_2.0.rb +0 -758
  32. data/test/test_maker_atom_entry.rb +0 -394
  33. data/test/test_maker_atom_feed.rb +0 -455
  34. data/test/test_maker_content.rb +0 -48
  35. data/test/test_maker_dc.rb +0 -150
  36. data/test/test_maker_image.rb +0 -63
  37. data/test/test_maker_itunes.rb +0 -488
  38. data/test/test_maker_slash.rb +0 -38
  39. data/test/test_maker_sy.rb +0 -45
  40. data/test/test_maker_taxo.rb +0 -82
  41. data/test/test_maker_trackback.rb +0 -42
  42. data/test/test_maker_xml-stylesheet.rb +0 -84
  43. data/test/test_parser.rb +0 -122
  44. data/test/test_parser_1.0.rb +0 -529
  45. data/test/test_parser_2.0.rb +0 -123
  46. data/test/test_parser_atom_entry.rb +0 -164
  47. data/test/test_parser_atom_feed.rb +0 -277
  48. data/test/test_setup_maker_0.9.rb +0 -247
  49. data/test/test_setup_maker_1.0.rb +0 -551
  50. data/test/test_setup_maker_2.0.rb +0 -309
  51. data/test/test_setup_maker_atom_entry.rb +0 -410
  52. data/test/test_setup_maker_atom_feed.rb +0 -446
  53. data/test/test_setup_maker_itunes.rb +0 -146
  54. data/test/test_setup_maker_slash.rb +0 -39
  55. data/test/test_slash.rb +0 -65
  56. data/test/test_syndication.rb +0 -126
  57. data/test/test_taxonomy.rb +0 -173
  58. data/test/test_to_s.rb +0 -701
  59. data/test/test_trackback.rb +0 -136
  60. data/test/test_xml-stylesheet.rb +0 -109
@@ -1,309 +0,0 @@
1
- # frozen_string_literal: false
2
- require_relative "rss-testcase"
3
-
4
- require "rss/maker"
5
-
6
- module RSS
7
- class TestSetupMaker20 < TestCase
8
-
9
- def test_setup_maker_channel
10
- title = "fugafuga"
11
- link = "http://hoge.com"
12
- description = "fugafugafugafuga"
13
- language = "ja"
14
- copyright = "foo"
15
- managingEditor = "bar"
16
- webMaster = "web master"
17
- rating = '(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi North America Server" for "http://www.rsac.org" on "1996.04.16T08:15-0500" r (n 0 s 0 v 0 l 0))'
18
- docs = "http://foo.com/doc"
19
- skipDays = [
20
- "Sunday",
21
- "Monday",
22
- ]
23
- skipHours = [
24
- "0",
25
- "13",
26
- ]
27
- pubDate = Time.now
28
- lastBuildDate = Time.now
29
- categories = [
30
- "Nespapers",
31
- "misc",
32
- ]
33
- generator = "RSS Maker"
34
- ttl = "60"
35
-
36
- rss = RSS::Maker.make("2.0") do |maker|
37
- maker.channel.title = title
38
- maker.channel.link = link
39
- maker.channel.description = description
40
- maker.channel.language = language
41
- maker.channel.copyright = copyright
42
- maker.channel.managingEditor = managingEditor
43
- maker.channel.webMaster = webMaster
44
- maker.channel.rating = rating
45
- maker.channel.docs = docs
46
- maker.channel.pubDate = pubDate
47
- maker.channel.lastBuildDate = lastBuildDate
48
-
49
- skipDays.each do |day|
50
- maker.channel.skipDays.new_day do |new_day|
51
- new_day.content = day
52
- end
53
- end
54
- skipHours.each do |hour|
55
- maker.channel.skipHours.new_hour do |new_hour|
56
- new_hour.content = hour
57
- end
58
- end
59
-
60
-
61
- categories.each do |category|
62
- maker.channel.categories.new_category do |new_category|
63
- new_category.content = category
64
- end
65
- end
66
-
67
- maker.channel.generator = generator
68
- maker.channel.ttl = ttl
69
- end
70
-
71
- new_rss = RSS::Maker.make("2.0") do |maker|
72
- rss.channel.setup_maker(maker)
73
- end
74
- channel = new_rss.channel
75
-
76
- assert_equal(title, channel.title)
77
- assert_equal(link, channel.link)
78
- assert_equal(description, channel.description)
79
- assert_equal(language, channel.language)
80
- assert_equal(copyright, channel.copyright)
81
- assert_equal(managingEditor, channel.managingEditor)
82
- assert_equal(webMaster, channel.webMaster)
83
- assert_equal(rating, channel.rating)
84
- assert_equal(docs, channel.docs)
85
- assert_equal(pubDate, channel.pubDate)
86
- assert_equal(lastBuildDate, channel.lastBuildDate)
87
-
88
- skipDays.each_with_index do |day, i|
89
- assert_equal(day, channel.skipDays.days[i].content)
90
- end
91
- skipHours.each_with_index do |hour, i|
92
- assert_equal(hour.to_i, channel.skipHours.hours[i].content)
93
- end
94
-
95
-
96
- channel.categories.each_with_index do |category, i|
97
- assert_equal(categories[i], category.content)
98
- end
99
-
100
- assert_equal(generator, channel.generator)
101
- assert_equal(ttl.to_i, channel.ttl)
102
-
103
-
104
- assert(channel.items.empty?)
105
- assert_nil(channel.image)
106
- assert_nil(channel.textInput)
107
- end
108
-
109
- def test_setup_maker_image
110
- title = "fugafuga"
111
- link = "http://hoge.com"
112
- url = "http://hoge.com/hoge.png"
113
- width = "144"
114
- height = "400"
115
- description = "an image"
116
-
117
- rss = RSS::Maker.make("2.0") do |maker|
118
- setup_dummy_channel(maker)
119
- maker.channel.link = link
120
-
121
- maker.image.title = title
122
- maker.image.url = url
123
- maker.image.width = width
124
- maker.image.height = height
125
- maker.image.description = description
126
- end
127
-
128
- new_rss = RSS::Maker.make("2.0") do |maker|
129
- rss.channel.setup_maker(maker)
130
- rss.image.setup_maker(maker)
131
- end
132
-
133
- image = new_rss.image
134
- assert_equal(title, image.title)
135
- assert_equal(link, image.link)
136
- assert_equal(url, image.url)
137
- assert_equal(width.to_i, image.width)
138
- assert_equal(height.to_i, image.height)
139
- assert_equal(description, image.description)
140
- end
141
-
142
- def test_setup_maker_textinput
143
- title = "fugafuga"
144
- description = "text hoge fuga"
145
- name = "hoge"
146
- link = "http://hoge.com"
147
-
148
- rss = RSS::Maker.make("2.0") do |maker|
149
- setup_dummy_channel(maker)
150
-
151
- maker.textinput.title = title
152
- maker.textinput.description = description
153
- maker.textinput.name = name
154
- maker.textinput.link = link
155
- end
156
-
157
- new_rss = RSS::Maker.make("2.0") do |maker|
158
- rss.channel.setup_maker(maker)
159
- rss.textinput.setup_maker(maker)
160
- end
161
-
162
- textInput = new_rss.channel.textInput
163
- assert_equal(title, textInput.title)
164
- assert_equal(description, textInput.description)
165
- assert_equal(name, textInput.name)
166
- assert_equal(link, textInput.link)
167
- end
168
-
169
- def test_setup_maker_items(for_backward_compatibility=false)
170
- title = "TITLE"
171
- link = "http://hoge.com/"
172
- description = "text hoge fuga"
173
- author = "oprah@oxygen.net"
174
- comments = "http://www.myblog.org/cgi-local/mt/mt-comments.cgi?entry_id=290"
175
- pubDate = Time.now
176
-
177
- guid_isPermaLink = "true"
178
- guid_content = "http://inessential.com/2002/09/01.php#a2"
179
-
180
- enclosure_url = "http://www.scripting.com/mp3s/weatherReportSuite.mp3"
181
- enclosure_length = "12216320"
182
- enclosure_type = "audio/mpeg"
183
-
184
- source_url = "http://static.userland.com/tomalak/links2.xml"
185
- source_content = "Tomalak's Realm"
186
-
187
- category_domain = "http://www.fool.com/cusips"
188
- category_content = "MSFT"
189
-
190
- item_size = 5
191
-
192
- rss = RSS::Maker.make("2.0") do |maker|
193
- setup_dummy_channel(maker)
194
-
195
- item_size.times do |i|
196
- maker.items.new_item do |item|
197
- item.title = "#{title}#{i}"
198
- item.link = "#{link}#{i}"
199
- item.description = "#{description}#{i}"
200
- item.author = "#{author}#{i}"
201
- item.comments = "#{comments}#{i}"
202
- item.date = pubDate
203
-
204
- item.guid.isPermaLink = guid_isPermaLink
205
- item.guid.content = guid_content
206
-
207
- item.enclosure.url = enclosure_url
208
- item.enclosure.length = enclosure_length
209
- item.enclosure.type = enclosure_type
210
-
211
- item.source.url = source_url
212
- item.source.content = source_content
213
-
214
- category = item.categories.new_category
215
- category.domain = category_domain
216
- category.content = category_content
217
- end
218
- end
219
- end
220
-
221
- new_rss = RSS::Maker.make("2.0") do |maker|
222
- rss.channel.setup_maker(maker)
223
-
224
- rss.items.each do |item|
225
- if for_backward_compatibility
226
- item.setup_maker(maker)
227
- else
228
- item.setup_maker(maker.items)
229
- end
230
- end
231
- end
232
-
233
- assert_equal(item_size, new_rss.items.size)
234
- new_rss.items.each_with_index do |item, i|
235
- assert_equal("#{title}#{i}", item.title)
236
- assert_equal("#{link}#{i}", item.link)
237
- assert_equal("#{description}#{i}", item.description)
238
- assert_equal("#{author}#{i}", item.author)
239
- assert_equal("#{comments}#{i}", item.comments)
240
- assert_equal(pubDate, item.pubDate)
241
-
242
- assert_equal(guid_isPermaLink == "true", item.guid.isPermaLink)
243
- assert_equal(guid_content, item.guid.content)
244
-
245
- assert_equal(enclosure_url, item.enclosure.url)
246
- assert_equal(enclosure_length.to_i, item.enclosure.length)
247
- assert_equal(enclosure_type, item.enclosure.type)
248
-
249
- assert_equal(source_url, item.source.url)
250
- assert_equal(source_content, item.source.content)
251
-
252
- assert_equal(1, item.categories.size)
253
- assert_equal(category_domain, item.category.domain)
254
- assert_equal(category_content, item.category.content)
255
- end
256
-
257
- end
258
-
259
- def test_setup_maker_items_backward_compatibility
260
- test_setup_maker_items(true)
261
- end
262
-
263
- def test_setup_maker
264
- encoding = "EUC-JP"
265
- standalone = true
266
-
267
- href = 'a.xsl'
268
- type = 'text/xsl'
269
- title = 'sample'
270
- media = 'printer'
271
- charset = 'UTF-8'
272
- alternate = 'yes'
273
-
274
- rss = RSS::Maker.make("2.0") do |maker|
275
- maker.encoding = encoding
276
- maker.standalone = standalone
277
-
278
- maker.xml_stylesheets.new_xml_stylesheet do |xss|
279
- xss.href = href
280
- xss.type = type
281
- xss.title = title
282
- xss.media = media
283
- xss.charset = charset
284
- xss.alternate = alternate
285
- end
286
-
287
- setup_dummy_channel(maker)
288
- end
289
-
290
- new_rss = RSS::Maker.make("2.0") do |maker|
291
- rss.setup_maker(maker)
292
- end
293
-
294
- assert_equal("2.0", new_rss.rss_version)
295
- assert_equal(encoding, new_rss.encoding)
296
- assert_equal(standalone, new_rss.standalone)
297
-
298
- xss = rss.xml_stylesheets.first
299
- assert_equal(1, rss.xml_stylesheets.size)
300
- assert_equal(href, xss.href)
301
- assert_equal(type, xss.type)
302
- assert_equal(title, xss.title)
303
- assert_equal(media, xss.media)
304
- assert_equal(charset, xss.charset)
305
- assert_equal(alternate, xss.alternate)
306
- end
307
-
308
- end
309
- end
@@ -1,410 +0,0 @@
1
- # frozen_string_literal: false
2
- require_relative "rss-testcase"
3
-
4
- require "rss/maker"
5
-
6
- module RSS
7
- class TestSetupMakerAtomEntry < TestCase
8
- def setup
9
- t = Time.iso8601("2000-01-01T12:00:05+00:00")
10
- class << t
11
- alias_method(:to_s, :iso8601)
12
- end
13
-
14
- @dc_elems = {
15
- :title => "hoge",
16
- :description =>
17
- " XML is placing increasingly heavy loads on
18
- the existing technical infrastructure of the Internet.",
19
- :creator => "Rael Dornfest (mailto:rael@oreilly.com)",
20
- :subject => "XML",
21
- :publisher => "The O'Reilly Network",
22
- :contributor => "hogehoge",
23
- :type => "fugafuga",
24
- :format => "hohoho",
25
- :identifier => "fufufu",
26
- :source => "barbar",
27
- :language => "ja",
28
- :relation => "cococo",
29
- :rights => "Copyright (c) 2000 O'Reilly &amp; Associates, Inc.",
30
- :date => t,
31
- }
32
- end
33
-
34
- def test_setup_maker_entry(with_dc=true)
35
- authors = [
36
- {
37
- :name => "Bob",
38
- :uri => "http://example.com/~bob/",
39
- :email => "bob@example.com",
40
- },
41
- {
42
- :name => "Alice",
43
- :uri => "http://example.com/~alice/",
44
- :email => "alice@example.com",
45
- },
46
- ]
47
- categories = [
48
- {
49
- :term => "music",
50
- :label => "Music",
51
- },
52
- {
53
- :term => "book",
54
- :scheme => "http://example.com/category/book/",
55
- :label => "Book",
56
- },
57
- ]
58
- contributors = [
59
- {
60
- :name => "Chris",
61
- :email => "chris@example.com",
62
- },
63
- {
64
- :name => "Eva",
65
- :uri => "http://example.com/~eva/",
66
- },
67
- ]
68
- id = "urn:uuid:8b105336-7e20-45fc-bb78-37fb3e1db25a"
69
- link = "http://hoge.com"
70
- published = Time.now - 60 * 3600
71
- rights = "Copyrights (c) 2007 Alice and Bob"
72
- description = "fugafugafugafuga"
73
- title = "fugafuga"
74
- updated = Time.now
75
-
76
- feed = RSS::Maker.make("atom:entry") do |maker|
77
- maker.items.new_item do |item|
78
- authors.each do |author_info|
79
- item.authors.new_author do |author|
80
- author_info.each do |key, value|
81
- author.__send__("#{key}=", value)
82
- end
83
- end
84
- end
85
-
86
- categories.each do |category_info|
87
- item.categories.new_category do |category|
88
- category_info.each do |key, value|
89
- category.__send__("#{key}=", value)
90
- end
91
- end
92
- end
93
-
94
- contributors.each do |contributor_info|
95
- item.contributors.new_contributor do |contributor|
96
- contributor_info.each do |key, value|
97
- contributor.__send__("#{key}=", value)
98
- end
99
- end
100
- end
101
-
102
- item.id = id
103
- item.link = link
104
- item.published = published
105
- item.rights = rights
106
- item.description = description
107
- item.title = title
108
- item.updated = updated
109
-
110
- if with_dc
111
- @dc_elems.each do |var, value|
112
- if var == :date
113
- item.new_dc_date(value)
114
- else
115
- item.__send__("dc_#{var}=", value)
116
- end
117
- end
118
- end
119
- end
120
- end
121
- assert_not_nil(feed)
122
-
123
- new_feed = RSS::Maker.make("atom:entry") do |maker|
124
- feed.setup_maker(maker)
125
- end
126
- assert_not_nil(new_feed)
127
-
128
- new_authors = new_feed.authors.collect do |author|
129
- {
130
- :name => author.name.content,
131
- :uri => author.uri.content,
132
- :email => author.email.content,
133
- }
134
- end
135
- assert_equal(authors, new_authors)
136
-
137
- new_categories = new_feed.categories.collect do |category|
138
- {
139
- :term => category.term,
140
- :scheme => category.scheme,
141
- :label => category.label,
142
- }.reject {|key, value| value.nil?}
143
- end
144
- assert_equal(categories, new_categories)
145
-
146
- new_contributors = new_feed.contributors.collect do |contributor|
147
- info = {}
148
- info[:name] = contributor.name.content
149
- info[:uri] = contributor.uri.content if contributor.uri
150
- info[:email] = contributor.email.content if contributor.email
151
- info
152
- end
153
- assert_equal(contributors, new_contributors)
154
-
155
- assert_equal(id, new_feed.id.content)
156
- assert_equal(link, new_feed.link.href)
157
- assert_equal(published, new_feed.published.content)
158
- assert_equal(rights, new_feed.rights.content)
159
- assert_equal(description, new_feed.summary.content)
160
- assert_equal(title, new_feed.title.content)
161
- assert_equal(updated, new_feed.updated.content)
162
-
163
- if with_dc
164
- @dc_elems.each do |var, value|
165
- if var == :date
166
- assert_equal([updated, value],
167
- new_feed.dc_dates.collect {|date| date.value})
168
- else
169
- assert_equal(value, new_feed.__send__("dc_#{var}"))
170
- end
171
- end
172
- end
173
-
174
- assert_equal(1, new_feed.items.size)
175
- end
176
-
177
- def test_setup_maker_entry_without_dc
178
- test_setup_maker_entry(false)
179
- end
180
-
181
- def test_setup_maker_items(for_backward_compatibility=false)
182
- title = "TITLE"
183
- link = "http://hoge.com/"
184
- description = "text hoge fuga"
185
- updated = Time.now
186
-
187
- item_size = 5
188
- feed = RSS::Maker.make("atom:entry") do |maker|
189
- setup_dummy_channel_atom(maker)
190
-
191
- item_size.times do |i|
192
- maker.items.new_item do |item|
193
- item.title = "#{title}#{i}"
194
- item.link = "#{link}#{i}"
195
- item.description = "#{description}#{i}"
196
- item.updated = updated + i * 60
197
- end
198
- end
199
- end
200
-
201
- new_feed = RSS::Maker.make("atom:entry") do |maker|
202
- feed.items.each do |item|
203
- if for_backward_compatibility
204
- item.setup_maker(maker)
205
- else
206
- item.setup_maker(maker.items)
207
- end
208
- end
209
-
210
- feed.items.clear
211
- feed.setup_maker(maker)
212
- end
213
-
214
- assert_equal(1, new_feed.items.size)
215
- new_feed.items[0..1].each_with_index do |item, i|
216
- assert_equal("#{title}#{i}", item.title.content)
217
- assert_equal("#{link}#{i}", item.link.href)
218
- assert_equal("#{description}#{i}", item.summary.content)
219
- assert_equal(updated + i * 60, item.updated.content)
220
- end
221
- end
222
-
223
- def test_setup_maker_items_sort
224
- title = "TITLE"
225
- link = "http://hoge.com/"
226
- summary = "text hoge fuga"
227
- updated = Time.now
228
-
229
- feed_size = 5
230
- feed = RSS::Maker.make("atom:entry") do |maker|
231
- setup_dummy_channel_atom(maker)
232
-
233
- feed_size.times do |i|
234
- entry_class = RSS::Atom::Entry
235
- entry = entry_class.new
236
- entry.title = entry_class::Title.new(:content => "#{title}#{i}")
237
- entry.links << entry_class::Link.new(:href => "#{link}#{i}")
238
- entry.summary = entry_class::Summary.new(:content => "#{summary}#{i}")
239
- entry.updated = entry_class::Updated.new(:content => updated + i * 60)
240
- entry.setup_maker(maker.items)
241
- end
242
- maker.items.do_sort = false
243
- end
244
- assert_equal(1, feed.items.size)
245
-
246
- assert_equal("#{title}0", feed.title.content)
247
- assert_equal("#{link}0", feed.link.href)
248
- assert_equal("#{summary}0", feed.summary.content)
249
-
250
-
251
- feed = RSS::Maker.make("atom:entry") do |maker|
252
- setup_dummy_channel_atom(maker)
253
-
254
- feed_size.times do |i|
255
- entry_class = RSS::Atom::Entry
256
- entry = entry_class.new
257
- entry.title = entry_class::Title.new(:content => "#{title}#{i}")
258
- entry.links << entry_class::Link.new(:href => "#{link}#{i}")
259
- entry.summary = entry_class::Summary.new(:content => "#{summary}#{i}")
260
- entry.updated = entry_class::Updated.new(:content => updated + i * 60)
261
- entry.setup_maker(maker.items)
262
- end
263
- maker.items.do_sort = true
264
- end
265
- assert_equal(1, feed.items.size)
266
-
267
- assert_equal("#{title}#{feed_size - 1}", feed.title.content)
268
- assert_equal("#{link}#{feed_size - 1}", feed.link.href)
269
- assert_equal("#{summary}#{feed_size - 1}", feed.summary.content)
270
- end
271
-
272
- def test_setup_maker_items_backward_compatibility
273
- test_setup_maker_items(true)
274
- end
275
-
276
- def test_setup_maker
277
- encoding = "EUC-JP"
278
- standalone = true
279
-
280
- href = 'a.xsl'
281
- type = 'text/xsl'
282
- title = 'sample'
283
- media = 'printer'
284
- charset = 'UTF-8'
285
- alternate = 'yes'
286
-
287
- feed = RSS::Maker.make("atom:entry") do |maker|
288
- maker.encoding = encoding
289
- maker.standalone = standalone
290
-
291
- maker.xml_stylesheets.new_xml_stylesheet do |xss|
292
- xss.href = href
293
- xss.type = type
294
- xss.title = title
295
- xss.media = media
296
- xss.charset = charset
297
- xss.alternate = alternate
298
- end
299
-
300
- setup_dummy_channel_atom(maker)
301
- setup_dummy_item_atom(maker)
302
- end
303
- assert_not_nil(feed)
304
-
305
- new_feed = RSS::Maker.make("atom:entry") do |maker|
306
- feed.setup_maker(maker)
307
- end
308
-
309
- assert_equal(["atom", "1.0", "entry"], new_feed.feed_info)
310
- assert_equal(encoding, new_feed.encoding)
311
- assert_equal(standalone, new_feed.standalone)
312
-
313
- xss = new_feed.xml_stylesheets.first
314
- assert_equal(1, new_feed.xml_stylesheets.size)
315
- assert_equal(href, xss.href)
316
- assert_equal(type, xss.type)
317
- assert_equal(title, xss.title)
318
- assert_equal(media, xss.media)
319
- assert_equal(charset, xss.charset)
320
- assert_equal(alternate, xss.alternate)
321
- end
322
-
323
- def test_setup_maker_full
324
- encoding = "EUC-JP"
325
- standalone = true
326
-
327
- href = 'a.xsl'
328
- type = 'text/xsl'
329
- title = 'sample'
330
- media = 'printer'
331
- charset = 'UTF-8'
332
- alternate = 'yes'
333
-
334
- channel_about = "http://hoge.com"
335
- channel_title = "fugafuga"
336
- channel_link = "http://hoge.com"
337
- channel_description = "fugafugafugafuga"
338
- channel_author = "Bob"
339
-
340
- image_url = "http://hoge.com/hoge.png"
341
-
342
- item_title = "TITLE"
343
- item_link = "http://hoge.com/"
344
- item_description = "text hoge fuga"
345
-
346
- entry_size = 5
347
- feed = RSS::Maker.make("atom:entry") do |maker|
348
- maker.encoding = encoding
349
- maker.standalone = standalone
350
-
351
- maker.xml_stylesheets.new_xml_stylesheet do |xss|
352
- xss.href = href
353
- xss.type = type
354
- xss.title = title
355
- xss.media = media
356
- xss.charset = charset
357
- xss.alternate = alternate
358
- end
359
-
360
- maker.channel.about = channel_about
361
- maker.channel.title = channel_title
362
- maker.channel.link = channel_link
363
- maker.channel.description = channel_description
364
- maker.channel.author = channel_author
365
- @dc_elems.each do |var, value|
366
- maker.channel.__send__("dc_#{var}=", value)
367
- end
368
-
369
- maker.image.url = image_url
370
-
371
- entry_size.times do |i|
372
- maker.items.new_item do |item|
373
- item.title = "#{item_title}#{i}"
374
- item.link = "#{item_link}#{i}"
375
- item.description = "#{item_description}#{i}"
376
-
377
- @dc_elems.each do |var, value|
378
- item.__send__("dc_#{var}=", value)
379
- end
380
- end
381
- end
382
- end
383
-
384
- new_feed = RSS::Maker.make("atom:entry") do |maker|
385
- feed.setup_maker(maker)
386
- end
387
-
388
- assert_equal(["atom", "1.0", "entry"], new_feed.feed_info)
389
- assert_equal(encoding, new_feed.encoding)
390
- assert_equal(standalone, new_feed.standalone)
391
-
392
- xss = new_feed.xml_stylesheets.first
393
- assert_equal(1, new_feed.xml_stylesheets.size)
394
- assert_equal(href, xss.href)
395
- assert_equal(type, xss.type)
396
- assert_equal(title, xss.title)
397
- assert_equal(media, xss.media)
398
- assert_equal(charset, xss.charset)
399
- assert_equal(alternate, xss.alternate)
400
-
401
- assert_equal("#{item_title}0", new_feed.title.content)
402
- assert_equal("#{item_link}0", new_feed.link.href)
403
- assert_equal("#{item_description}0", new_feed.summary.content)
404
- @dc_elems.each do |var, value|
405
- assert_equal(value, new_feed.__send__("dc_#{var}"))
406
- end
407
- assert_equal(1, new_feed.items.size)
408
- end
409
- end
410
- end