summaryrefslogtreecommitdiff
path: root/trunk/test/rss/test_parser_2.0.rb
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-25 15:13:14 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-25 15:13:14 +0000
commitd0233291bc8a5068e52c69c210e5979e5324b5bc (patch)
tree7d9459449c33792c63eeb7baa071e76352e0baab /trunk/test/rss/test_parser_2.0.rb
parent0dc342de848a642ecce8db697b8fecd83a63e117 (diff)
parent72eaacaa15256ab95c3b52ea386f88586fb9da40 (diff)
re-adding tag v1_9_0_4 as an alias of trunk@18848v1_9_0_4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_0_4@18849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'trunk/test/rss/test_parser_2.0.rb')
-rw-r--r--trunk/test/rss/test_parser_2.0.rb122
1 files changed, 0 insertions, 122 deletions
diff --git a/trunk/test/rss/test_parser_2.0.rb b/trunk/test/rss/test_parser_2.0.rb
deleted file mode 100644
index 249347d3dc..0000000000
--- a/trunk/test/rss/test_parser_2.0.rb
+++ /dev/null
@@ -1,122 +0,0 @@
-require "rss-testcase"
-
-require "rss/2.0"
-
-module RSS
- class TestParser20 < TestCase
- def test_rss20
- assert_parse(make_rss20(<<-EOR), :missing_tag, "channel", "rss")
-EOR
-
- assert_parse(make_rss20(<<-EOR), :nothing_raised)
-#{make_channel20("")}
-EOR
- end
-
- def test_cloud20
- attrs = [
- ["domain", CLOUD_DOMAIN],
- ["port", CLOUD_PORT],
- ["path", CLOUD_PATH],
- ["registerProcedure", CLOUD_REGISTER_PROCEDURE],
- ["protocol", CLOUD_PROTOCOL],
- ]
-
- (attrs.size + 1).times do |i|
- missing_attr = attrs[i]
- if missing_attr
- meth = :missing_attribute
- args = ["cloud", missing_attr[0]]
- else
- meth = :nothing_raised
- args = []
- end
-
- cloud_attrs = []
- attrs.each_with_index do |attr, j|
- unless i == j
- cloud_attrs << %Q[#{attr[0]}="#{attr[1]}"]
- end
- end
-
- assert_parse(make_rss20(<<-EOR), meth, *args)
-#{make_channel20(%Q[<cloud #{cloud_attrs.join("\n")}/>])}
-EOR
- end
- end
-
- def test_source20
- assert_parse(make_rss20(<<-EOR), :missing_attribute, "source", "url")
-#{make_channel20(make_item20(%Q[<source>Example</source>]))}
-EOR
-
- assert_parse(make_rss20(<<-EOR), :nothing_raised)
-#{make_channel20(make_item20(%Q[<source url="http://example.com/" />]))}
-EOR
-
- assert_parse(make_rss20(<<-EOR), :nothing_raised)
-#{make_channel20(make_item20(%Q[<source url="http://example.com/">Example</source>]))}
-EOR
- end
-
- def test_enclosure20
- attrs = [
- ["url", ENCLOSURE_URL],
- ["length", ENCLOSURE_LENGTH],
- ["type", ENCLOSURE_TYPE],
- ]
-
- (attrs.size + 1).times do |i|
- missing_attr = attrs[i]
- if missing_attr
- meth = :missing_attribute
- args = ["enclosure", missing_attr[0]]
- else
- meth = :nothing_raised
- args = []
- end
-
- enclosure_attrs = []
- attrs.each_with_index do |attr, j|
- unless i == j
- enclosure_attrs << %Q[#{attr[0]}="#{attr[1]}"]
- end
- end
-
- assert_parse(make_rss20(<<-EOR), meth, *args)
-#{make_channel20(%Q[
-#{make_item20(%Q[
-<enclosure
- #{enclosure_attrs.join("\n")} />
- ])}
- ])}
-EOR
- end
- end
-
- def test_category20
- values = [nil, CATEGORY_DOMAIN]
- values.each do |value|
- domain = ""
- domain << %Q[domain="#{value}"] if value
-
- ["", "Example Text"].each do |text|
- rss_src = make_rss20(<<-EOR)
-#{make_channel20(%Q[
-#{make_item20(%Q[
-<category #{domain}>#{text}</category>
- ])}
- ])}
-EOR
- assert_parse(rss_src, :nothing_raised)
-
- rss = RSS::Parser.parse(rss_src)
- category = rss.items.last.categories.first
- assert_equal(value, category.domain)
- assert_equal(text, category.content)
- end
- end
- end
- end
-end
-