openlogic-feed-normalizer 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,65 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1" ?>
2
+ <?xml-stylesheet title="XSL_formatting" type="text/xsl" href="/shared/bsp/xsl/rss/nolsol.xsl"?>
3
+ <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
4
+ <channel>
5
+ <title>BBC News | Technology | UK Edition</title>
6
+ <link>http://news.bbc.co.uk/go/rss/-/1/hi/technology/default.stm</link>
7
+ <description>Visit BBC News for up-to-the-minute news, breaking news, video, audio and feature stories. BBC News provides trusted World and UK news as well as local and regional perspectives. Also entertainment, business, science, technology and health news.</description>
8
+ <language>en-gb</language>
9
+ <lastBuildDate>Sat, 09 Sep 2006 14:57:06 GMT</lastBuildDate>
10
+ <copyright>Copyright: (C) British Broadcasting Corporation, see http://news.bbc.co.uk/1/hi/help/rss/4498287.stm for terms and conditions of reuse</copyright>
11
+ <docs>http://www.bbc.co.uk/syndication/</docs>
12
+ <ttl>15</ttl>
13
+ <skipHours>
14
+ <hour>6</hour>
15
+ <hour>7</hour>
16
+ <hour>8</hour>
17
+ <hour>9</hour>
18
+ <hour>10</hour>
19
+ <hour>11</hour>
20
+ </skipHours>
21
+ <skipDays>
22
+ <day>Sunday</day>
23
+ </skipDays>
24
+
25
+ <image>
26
+ <title>BBC News</title>
27
+ <url>http://news.bbc.co.uk/nol/shared/img/bbc_news_120x60.gif</url>
28
+ <link>http://news.bbc.co.uk/go/rss/-/1/hi/technology/default.stm</link>
29
+ </image>
30
+
31
+ <item>
32
+ <title>Concerns over security software</title>
33
+ <description><![CDATA[BBC Click investigates free security software and finds out who will protect PCs when Microsoft launches Vista.]]></description>
34
+ <content:encoded> <![CDATA[<p>test1</p>]]> </content:encoded>
35
+ <link>http://news.bbc.co.uk/go/rss/-/1/hi/programmes/click_online/5326654.stm</link>
36
+ <guid isPermaLink="false">http://news.bbc.co.uk/1/hi/programmes/click_online/5326654.stm</guid>
37
+ <pubDate>Sat, 09 Sep 2006 12:45:35 GMT</pubDate>
38
+ <category>Click</category>
39
+ </item>
40
+
41
+ <item>
42
+ <title>Top prize for 'light' inventor</title>
43
+ <description>A Japanese scientist who invented a sustainable form of light is awarded the Millennium Technology Prize.</description>
44
+ <content:encoded><![CDATA[<p>test2</p>]]></content:encoded>
45
+ <link>http://news.bbc.co.uk/go/rss/-/1/hi/technology/5328446.stm</link>
46
+ <enclosure url="http://websrvr60ny.audiovideoweb.com/ny60web16519/LTN/POA/POA_042905.mp3" length="12619776" type="audio/mpeg"></enclosure>
47
+ <guid isPermaLink="false">http://news.bbc.co.uk/1/hi/technology/5328446.stm</guid>
48
+ <pubDate>Fri, 08 Sep 2006 16:18:08 GMT</pubDate>
49
+ <category>Technology</category>
50
+ <category>Japan</category>
51
+ </item>
52
+
53
+ <item>
54
+ <title>MP3 player court order overturned</title>
55
+ <description>&lt;b&gt;SanDisk&lt;/b&gt; puts its MP3 players back on display at a German electronics show after overturning a court injunction.</description>
56
+ <content:encoded><![CDATA[<p>test3</p>]]></content:encoded>
57
+ <link>http://news.bbc.co.uk/go/rss/-/1/hi/technology/5326660.stm</link>
58
+ <guid isPermaLink="false">http://news.bbc.co.uk/1/hi/technology/5326660.stm</guid>
59
+ <pubDate>Fri, 08 Sep 2006 10:14:41 GMT</pubDate>
60
+ </item>
61
+
62
+ <item/>
63
+ </channel>
64
+ </rss>
65
+
@@ -0,0 +1,59 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1" ?>
2
+ <?xml-stylesheet title="XSL_formatting" type="text/xsl" href="/shared/bsp/xsl/rss/nolsol.xsl"?>
3
+ <rss version="2.0">
4
+ <channel>
5
+ <title>diff</title>
6
+ <link>http://news.bbc.co.uk/go/rss/-/1/hi/technology/default.stm</link>
7
+ <description>Visit BBC News for up-to-the-minute news, breaking news, video, audio and feature stories. BBC News provides trusted World and UK news as well as local and regional perspectives. Also entertainment, business, science, technology and health news.</description>
8
+ <language>en-gb</language>
9
+ <lastBuildDate>Sat, 09 Sep 2006 14:57:06 GMT</lastBuildDate>
10
+ <copyright>Copyright: (C) British Broadcasting Corporation, see http://news.bbc.co.uk/1/hi/help/rss/4498287.stm for terms and conditions of reuse</copyright>
11
+ <docs>http://www.bbc.co.uk/syndication/</docs>
12
+ <ttl>15</ttl>
13
+ <skipHours>
14
+ <hour>6</hour>
15
+ <hour>7</hour>
16
+ <hour>8</hour>
17
+ <hour>9</hour>
18
+ <hour>10</hour>
19
+ <hour>11</hour>
20
+ </skipHours>
21
+ <skipDays>
22
+ <day>Sunday</day>
23
+ </skipDays>
24
+
25
+ <image>
26
+ <title>BBC News</title>
27
+ <url>http://news.bbc.co.uk/nol/shared/img/bbc_news_120x60.gif</url>
28
+ <link>http://news.bbc.co.uk/go/rss/-/1/hi/technology/default.stm</link>
29
+ </image>
30
+
31
+ <item>
32
+ <title>diff</title>
33
+ <description>BBC Click investigates free security software and finds out who will protect PCs when Microsoft launches Vista.</description>
34
+ <link>http://news.bbc.co.uk/go/rss/-/1/hi/programmes/click_online/5326654.stm</link>
35
+ <guid isPermaLink="false">http://news.bbc.co.uk/1/hi/programmes/click_online/5326654.stm</guid>
36
+ <pubDate>Sat, 09 Sep 2006 12:45:35 GMT</pubDate>
37
+ <category>Click</category>
38
+ </item>
39
+
40
+ <item>
41
+ <title>diff</title>
42
+ <description>diff</description>
43
+ <link>diff</link>
44
+ <guid isPermaLink="false">http://news.bbc.co.uk/1/hi/technology/5328446.stm</guid>
45
+ <pubDate>Fri, 08 Sep 2006 16:18:08 GMT</pubDate>
46
+ <category>diff</category>
47
+ </item>
48
+
49
+ <item>
50
+ <title>MP3 player court order overturned</title>
51
+ <description>SanDisk puts its MP3 players back on display at a German electronics show after overturning a court injunction.</description>
52
+ <link>http://news.bbc.co.uk/go/rss/-/1/hi/technology/5326660.stm</link>
53
+ <guid isPermaLink="false">http://news.bbc.co.uk/1/hi/technology/5326660.stm</guid>
54
+ <pubDate>Fri, 08 Sep 2006 10:14:41 GMT</pubDate>
55
+ </item>
56
+
57
+ </channel>
58
+ </rss>
59
+
@@ -0,0 +1,51 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1" ?>
2
+ <?xml-stylesheet title="XSL_formatting" type="text/xsl" href="/shared/bsp/xsl/rss/nolsol.xsl"?>
3
+ <rss version="2.0">
4
+ <channel>
5
+ <title>diff</title>
6
+ <link>http://news.bbc.co.uk/go/rss/-/1/hi/technology/default.stm</link>
7
+ <description>Visit BBC News for up-to-the-minute news, breaking news, video, audio and feature stories. BBC News provides trusted World and UK news as well as local and regional perspectives. Also entertainment, business, science, technology and health news.</description>
8
+ <language>en-gb</language>
9
+ <lastBuildDate>Sat, 09 Sep 2006 14:57:06 GMT</lastBuildDate>
10
+ <copyright>Copyright: (C) British Broadcasting Corporation, see http://news.bbc.co.uk/1/hi/help/rss/4498287.stm for terms and conditions of reuse</copyright>
11
+ <docs>http://www.bbc.co.uk/syndication/</docs>
12
+ <ttl>15</ttl>
13
+ <skipHours>
14
+ <hour>6</hour>
15
+ <hour>7</hour>
16
+ <hour>8</hour>
17
+ <hour>9</hour>
18
+ <hour>10</hour>
19
+ <hour>11</hour>
20
+ </skipHours>
21
+ <skipDays>
22
+ <day>Sunday</day>
23
+ </skipDays>
24
+
25
+ <image>
26
+ <title>BBC News</title>
27
+ <url>http://news.bbc.co.uk/nol/shared/img/bbc_news_120x60.gif</url>
28
+ <link>http://news.bbc.co.uk/go/rss/-/1/hi/technology/default.stm</link>
29
+ </image>
30
+
31
+ <item>
32
+ <title>diff</title>
33
+ <description>BBC Click investigates free security software and finds out who will protect PCs when Microsoft launches Vista.</description>
34
+ <link>http://news.bbc.co.uk/go/rss/-/1/hi/programmes/click_online/5326654.stm</link>
35
+ <guid isPermaLink="false">http://news.bbc.co.uk/1/hi/programmes/click_online/5326654.stm</guid>
36
+ <pubDate>Sat, 09 Sep 2006 12:45:35 GMT</pubDate>
37
+ <category>Click</category>
38
+ </item>
39
+
40
+ <item>
41
+ <title>diff</title>
42
+ <description>A Japanese scientist who invented a sustainable form of light is awarded the Millennium Technology Prize.</description>
43
+ <link>diff</link>
44
+ <guid isPermaLink="false">http://news.bbc.co.uk/1/hi/technology/5328446.stm</guid>
45
+ <pubDate>Fri, 08 Sep 2006 16:18:08 GMT</pubDate>
46
+ <category>diff</category>
47
+ </item>
48
+
49
+ </channel>
50
+ </rss>
51
+
@@ -0,0 +1,277 @@
1
+ $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../lib')))
2
+ require 'test/unit'
3
+ require 'feed-normalizer'
4
+ require 'yaml'
5
+
6
+ class FeedNormalizerTest < Test::Unit::TestCase
7
+
8
+ XML_FILES = {}
9
+
10
+ Fn = FeedNormalizer
11
+
12
+ data_dir = File.dirname(__FILE__) + '/data'
13
+
14
+ # Load up the xml files
15
+ Dir.open(data_dir).each do |fn|
16
+ next unless fn =~ /[.]xml$/
17
+ XML_FILES[File.basename(fn, File.extname(fn)).to_sym] = File.read(data_dir + "/#{fn}")
18
+ end
19
+
20
+ def test_basic_parse
21
+ assert_kind_of Fn::Feed, FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20])
22
+ end
23
+
24
+ def test_force_parser
25
+ assert_kind_of Fn::Feed, FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20],
26
+ :force_parser => Fn::RubyRssParser, :try_others => true)
27
+ end
28
+
29
+ def test_force_parser_exclusive
30
+ assert_kind_of Fn::Feed, FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20],
31
+ :force_parser => Fn::RubyRssParser, :try_others => false)
32
+ end
33
+
34
+ def test_ruby_rss_parser
35
+ assert_kind_of Fn::Feed, FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20],
36
+ :force_parser => Fn::RubyRssParser, :try_others => false)
37
+ assert_kind_of Fn::Feed, FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rdf10],
38
+ :force_parser => Fn::RubyRssParser, :try_others => false)
39
+ end
40
+
41
+ def test_simple_rss_parser
42
+ assert_kind_of Fn::Feed, FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20],
43
+ :force_parser => Fn::SimpleRssParser, :try_others => false)
44
+ assert_kind_of Fn::Feed, FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom10],
45
+ :force_parser => Fn::SimpleRssParser, :try_others => false)
46
+ end
47
+
48
+ def test_parser_failover_order
49
+ assert_equal 'SimpleRSS', FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom10], :force_parser => Fn::RubyRssParser).parser
50
+ end
51
+
52
+ def test_force_parser_fail
53
+ assert_nil FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom10], :force_parser => Fn::RubyRssParser, :try_others => false)
54
+ end
55
+
56
+ def test_all_parsers_fail
57
+ assert_nil FeedNormalizer::FeedNormalizer.parse("This isn't RSS or Atom!")
58
+ end
59
+
60
+ def test_correct_parser_used
61
+ assert_equal 'RSS::Parser', FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20]).parser
62
+ assert_equal 'SimpleRSS', FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom10]).parser
63
+ end
64
+
65
+ def test_rss
66
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20])
67
+
68
+ assert_equal "BBC News | Technology | UK Edition", feed.title
69
+ assert_equal ["http://news.bbc.co.uk/go/rss/-/1/hi/technology/default.stm"], feed.urls
70
+ assert_equal 15, feed.ttl
71
+ assert_equal [6, 7, 8, 9, 10, 11], feed.skip_hours
72
+ assert_equal ["Sunday"], feed.skip_days
73
+ assert_equal "MP3 player court order overturned", feed.entries.last.title
74
+ assert_equal "<b>SanDisk</b> puts its MP3 players back on display at a German electronics show after overturning a court injunction.", feed.entries.last.description
75
+ assert_match(/test\d/, feed.entries.last.content)
76
+ assert_instance_of Time, feed.entries.last.date_published
77
+ end
78
+
79
+ def test_simplerss
80
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom10])
81
+
82
+ assert_equal "~:caboose", feed.title
83
+ assert_equal "http://habtm.com/xml/atom10/feed.xml", feed.url
84
+ assert_equal nil, feed.ttl
85
+ assert_equal [], feed.skip_hours
86
+ assert_equal [], feed.skip_days
87
+ assert_equal "Starfish - Easy Distribution of Site Maintenance", feed.entries.last.title
88
+ assert_equal "urn:uuid:6c028f36-f87a-4f53-b7e3-1f943d2341f0", feed.entries.last.id
89
+
90
+ assert !feed.entries.last.description.include?("google fame")
91
+ assert feed.entries.last.content.include?("google fame")
92
+ end
93
+
94
+ def test_sanity_check
95
+ XML_FILES.keys.each do |xml_file|
96
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[xml_file])
97
+
98
+ assert [feed.parser, feed.title, feed.url, feed.entries.first.url].collect{|e| e.is_a?(String)}.all?, "Not everything was a String in #{xml_file}"
99
+ end
100
+ end
101
+
102
+ def test_feed_equality
103
+ assert_equal FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20]), FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20])
104
+ assert_equal FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom10]), FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom10])
105
+ assert_not_equal FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom03]), FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom10])
106
+ assert_not_equal FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20]), FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom10])
107
+ assert_not_equal FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20]), FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20diff])
108
+ end
109
+
110
+ def test_feed_diff
111
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20])
112
+
113
+ diff = feed.diff(FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20diff]))
114
+ diff_short = feed.diff(FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20diff_short]))
115
+ no_diff = feed.diff(feed)
116
+
117
+ assert diff.keys.all? {|key| [:title, :items].include?(key)}
118
+ assert_equal 3, diff[:items].size
119
+
120
+ assert diff_short.keys.all? {|key| [:title, :items].include?(key)}
121
+ assert_equal [3,2], diff_short[:items]
122
+
123
+ assert no_diff.empty?
124
+ end
125
+
126
+ def test_marshal
127
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20])
128
+
129
+ assert_nothing_raised { Marshal.load(Marshal.dump(feed)) }
130
+ end
131
+
132
+ def test_yaml
133
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20])
134
+ assert_nothing_raised { YAML.load(YAML.dump(feed)) }
135
+ end
136
+
137
+ def test_method_missing
138
+ assert_raise(NoMethodError) { FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20]).nonexistent }
139
+
140
+ # Another test of Singular's method_missing: sending :flatten to a 2-D array of FeedNormalizer::Entrys
141
+ # causes :to_ary to be sent to the Entrys.
142
+ assert_nothing_raised { [[Fn::Entry.new], [Fn::Entry.new]].flatten }
143
+ end
144
+
145
+ def test_clean
146
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom10])
147
+
148
+ assert_match(/<plaintext>/, feed.entries.first.content)
149
+ assert_match(/<plaintext>/, feed.entries.first.description)
150
+ feed.clean!
151
+ assert_no_match(/<plaintext>/, feed.entries.first.content)
152
+ assert_no_match(/<plaintext>/, feed.entries.first.description)
153
+ end
154
+
155
+ def test_malformed_feed
156
+ assert_nothing_raised { FeedNormalizer::FeedNormalizer.parse('<feed></feed>') }
157
+ end
158
+
159
+ def test_dublin_core_date_ruby_rss
160
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rdf10], :force_parser => Fn::RubyRssParser, :try_others => false)
161
+ assert_instance_of Time, feed.entries.first.date_published
162
+ end
163
+
164
+ def test_dublin_core_date_simple_rss
165
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rdf10], :force_parser => Fn::SimpleRssParser, :try_others => false)
166
+ assert_instance_of Time, feed.entries.first.date_published
167
+ end
168
+
169
+ def test_dublin_core_creator_ruby_rss
170
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rdf10], :force_parser => Fn::RubyRssParser, :try_others => false)
171
+ assert_equal 'Jeff Hecht', feed.entries.last.author
172
+ end
173
+
174
+ def test_dublin_core_creator_simple_rss
175
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rdf10], :force_parser => Fn::SimpleRssParser, :try_others => false)
176
+ assert_equal 'Jeff Hecht', feed.entries.last.author
177
+ end
178
+
179
+ def test_entry_categories_ruby_rss
180
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20], :force_parser => Fn::RubyRssParser, :try_others => false)
181
+ assert_equal [['Click'],['Technology'],[]], feed.items.collect {|i|i.categories}
182
+ end
183
+
184
+ def test_entry_categories_simple_rss
185
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20], :force_parser => Fn::SimpleRssParser, :try_others => false)
186
+ assert_equal [['Click'],['Technology'],[]], feed.items.collect {|i|i.categories}
187
+ end
188
+
189
+ def test_loose_categories_ruby_rss
190
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20], :force_parser => Fn::RubyRssParser, :try_others => false, :loose => true)
191
+ assert_equal [1,2,0], feed.entries.collect{|e|e.categories.size}
192
+ end
193
+
194
+ def test_loose_categories_simple_rss
195
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20], :force_parser => Fn::SimpleRssParser, :try_others => false, :loose => true)
196
+ assert_equal [1,1,0], feed.entries.collect{|e|e.categories.size}
197
+ end
198
+
199
+ def test_content_encoded_simple_rss
200
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20], :force_parser => Fn::SimpleRssParser, :try_others => false)
201
+
202
+ feed.entries.each_with_index do |e, i|
203
+ assert_match(/\s*<p>test#{i+1}<\/p>\s*/, e.content)
204
+ end
205
+ end
206
+
207
+ def test_content_encoded_ruby_rss
208
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20], :force_parser => Fn::RubyRssParser, :try_others => false)
209
+
210
+ feed.entries.each_with_index do |e, i|
211
+ assert_match(/\s*<p>test#{i+1}<\/p>\s*/, e.content)
212
+ end
213
+ end
214
+
215
+ def test_atom_content_contains_pluses
216
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom10], :force_parser => Fn::SimpleRssParser, :try_others => false)
217
+
218
+ assert_equal 2, feed.entries.last.content.scan(/\+/).size
219
+ end
220
+
221
+ # http://code.google.com/p/feed-normalizer/issues/detail?id=13
222
+ def test_times_are_reparsed
223
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20], :force_parser => Fn::RubyRssParser, :try_others => false)
224
+
225
+ Time.class_eval "alias :old_to_s :to_s; def to_s(x=1); old_to_s; end"
226
+
227
+ assert_equal Time.parse("Sat Sep 09 10:57:06 -0400 2006").to_s, feed.last_updated.to_s(:foo)
228
+ assert_equal Time.parse("Sat Sep 09 08:45:35 -0400 2006").to_s, feed.entries.first.date_published.to_s(:foo)
229
+ end
230
+
231
+ def test_atom03_has_issued
232
+ SimpleRSS.class_eval "@@item_tags.delete(:issued)"
233
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom03], :force_parser => Fn::SimpleRssParser, :try_others => false)
234
+ assert_nil feed.entries.first.date_published
235
+
236
+ SimpleRSS.class_eval "@@item_tags << :issued"
237
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom03], :force_parser => Fn::SimpleRssParser, :try_others => false)
238
+ assert_equal "Tue Aug 29 02:31:03 UTC 2006", feed.entries.first.date_published.to_s
239
+ end
240
+
241
+ def test_html_should_be_escaped_by_default
242
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20], :force_parser => Fn::RubyRssParser, :try_others => false)
243
+ assert_match "<b>SanDisk</b>", feed.items.last.description
244
+
245
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20], :force_parser => Fn::SimpleRssParser, :try_others => false)
246
+ assert_match "<b>SanDisk</b>", feed.items.last.description
247
+ end
248
+
249
+ def test_relative_links_and_images_should_be_rewritten_with_url_base
250
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom03])
251
+ assert_match '<a href="http://www.cheapstingybargains.com/link/tplclick?lid=41000000011334249&#038;pubid=21000000000053626"' +
252
+ ' target=_"blank"><img src="http://www.cheapstingybargains.com/assets/images/product/productDetail/9990000058546711.jpg"' +
253
+ ' width="150" height="150" border="0" style="float: right; margin: 0px 0px 5px 5px;" /></a>',
254
+ feed.items.first.content
255
+ end
256
+
257
+ def test_last_updated_simple_rss
258
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:atom10], :force_parser => Fn::SimpleRssParser, :try_others => false)
259
+
260
+ assert_equal Time.parse("Wed Aug 16 09:59:44 -0700 2006"), feed.entries.first.last_updated
261
+ end
262
+
263
+ def test_last_updated_ruby_rss
264
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20], :force_parser => Fn::RubyRssParser, :try_others => false)
265
+
266
+ assert_equal feed.entries.first.date_published, feed.entries.first.last_updated
267
+ end
268
+
269
+ def test_skip_empty_items
270
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20], :force_parser => Fn::RubyRssParser, :try_others => false)
271
+ assert_not_nil feed.items.last.description
272
+
273
+ feed = FeedNormalizer::FeedNormalizer.parse(XML_FILES[:rss20], :force_parser => Fn::SimpleRssParser, :try_others => false)
274
+ assert_not_nil feed.items.last.description
275
+ end
276
+ end
277
+