summaryrefslogtreecommitdiff
path: root/test/rss/test_2.0.rb
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-21 12:19:43 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-21 12:19:43 +0000
commit57a639494a2a002f496a945979e2bf499b0d9fdb (patch)
tree53fadfc1666459e1286735a37171539883d66d70 /test/rss/test_2.0.rb
parent754b1fac44487454cc25a14443615c0fba3da6ad (diff)
* lib/rss.rb, lib/rss/, test/rss/, sample/rss/: merged from trunk.
- 0.1.6 -> 2.0.0. - fixed image module URI. Thanks to Dmitry Borodaenko. - supported Atom. - supported ITunes module. - supported Slash module. * NEWS: added an entry for RSS Parser. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rss/test_2.0.rb')
-rw-r--r--test/rss/test_2.0.rb28
1 files changed, 24 insertions, 4 deletions
diff --git a/test/rss/test_2.0.rb b/test/rss/test_2.0.rb
index d39c297ab7..5a63efbcb9 100644
--- a/test/rss/test_2.0.rb
+++ b/test/rss/test_2.0.rb
@@ -2,8 +2,6 @@ require "rexml/document"
require "rss-testcase"
-require "rss/2.0"
-
module RSS
class TestRSS20Core < TestCase
@@ -17,6 +15,7 @@ module RSS
standalone = false
rss = Rss.new(@rss_version, version, encoding, standalone)
+ setup_rss20(rss)
doc = REXML::Document.new(rss.to_s(false))
@@ -48,7 +47,9 @@ module RSS
{:href => "a.css", :type => "text/css"},
],
].each do |attrs_ary|
- assert_xml_stylesheet_pis(attrs_ary, Rss.new(@rss_version))
+ rss = Rss.new(@rss_version)
+ setup_rss20(rss)
+ assert_xml_stylesheet_pis(attrs_ary, rss)
end
end
@@ -253,6 +254,10 @@ module RSS
pubDate = Time.parse("Sat, 07 Sep 2002 00:00:01 GMT")
channel = Rss::Channel.new
+ channel.title = "title"
+ channel.link = "http://example.com/"
+ channel.description = "description"
+
item = Rss::Channel::Item.new
channel.items << item
@@ -378,13 +383,28 @@ module RSS
rss = RSS::Parser.parse(make_sample_rss20)
assert_equal(rss.to_s, rss.to_xml)
assert_equal(rss.to_s, rss.to_xml("2.0"))
- rss09 = RSS::Parser.parse(rss.to_xml("0.91"))
+ rss09_xml = rss.to_xml("0.91") do |maker|
+ setup_dummy_image(maker)
+ end
+ rss09 = RSS::Parser.parse(rss09_xml)
assert_equal("0.91", rss09.rss_version)
rss10 = rss.to_xml("1.0") do |maker|
maker.channel.about = "http://www.example.com/index.rdf"
end
rss10 = RSS::Parser.parse(rss10)
assert_equal("1.0", rss10.rss_version)
+
+ atom_xml = rss.to_xml("atom1.0") do |maker|
+ maker.channel.id = "http://www.example.com/atom.xml"
+ maker.channel.author = "Alice"
+ maker.channel.updated = Time.now
+ maker.items.each do |item|
+ item.author = "Bob"
+ item.updated = Time.now
+ end
+ end
+ atom = RSS::Parser.parse(atom_xml)
+ assert_equal(["atom", "1.0", "feed"], atom.feed_info)
end
end
end