summaryrefslogtreecommitdiff
path: root/test/rss/test_content.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-01-11 21:48:06 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2020-01-12 12:28:29 +0900
commit83240f315a10b42b53c3b62c1fbc428f97912665 (patch)
tree2d17b6aded6273ecd7b2c8a27bd4accfb7bd5f2d /test/rss/test_content.rb
parentc3ccf23d5807f2ff20127bf5e42df0977bf672fb (diff)
Make rss library to the bundle gems
[Feature #16485][ruby-core:96683]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2832
Diffstat (limited to 'test/rss/test_content.rb')
-rw-r--r--test/rss/test_content.rb105
1 files changed, 0 insertions, 105 deletions
diff --git a/test/rss/test_content.rb b/test/rss/test_content.rb
deleted file mode 100644
index fc8269df12..0000000000
--- a/test/rss/test_content.rb
+++ /dev/null
@@ -1,105 +0,0 @@
-# frozen_string_literal: false
-require "cgi"
-require "rexml/document"
-
-require_relative "rss-testcase"
-
-require "rss/content"
-
-module RSS
- class TestContent < TestCase
- def setup
- @prefix = "content"
- @uri = "http://purl.org/rss/1.0/modules/content/"
-
- @elems = {
- :encoded => "<em>ATTENTION</em>",
- }
-
- @content_nodes = @elems.collect do |name, value|
- "<#{@prefix}:#{name}>#{CGI.escapeHTML(value.to_s)}</#{@prefix}:#{name}>"
- end.join("\n")
-
- @rss10_source = make_RDF(<<-EOR, {@prefix => @uri})
-#{make_channel()}
-#{make_image()}
-#{make_item(@content_nodes)}
-#{make_textinput()}
-EOR
-
- @rss10 = Parser.parse(@rss10_source)
-
-
- @rss20_source = make_rss20(<<-EOR, {@prefix => @uri})
-#{make_channel20(make_item20(@content_nodes))}
-EOR
-
- @rss20 = Parser.parse(@rss20_source)
- end
-
- def test_parser
- assert_nothing_raised do
- Parser.parse(@rss10_source)
- end
-
- assert_nothing_raised do
- Parser.parse(@rss20_source)
- end
-
- @elems.each do |tag, value|
- tag_name = "#{@prefix}:#{tag}"
- content_encodes = make_element(tag_name, {}, value) * 2
-
- assert_too_much_tag(tag.to_s, "item") do
- Parser.parse(make_RDF(<<-EOR, {@prefix => @uri}))
-#{make_channel}
-#{make_item(content_encodes)}
-EOR
- end
-
- assert_too_much_tag(tag.to_s, "item") do
- Parser.parse(make_rss20(<<-EOR, {@prefix => @uri}))
-#{make_channel20(make_item20(content_encodes))}
-EOR
- end
- end
- end
-
- def test_accessor
- new_value = {
- :encoded => "<![CDATA[<it>hoge</it>]]>",
- }
-
- @elems.each do |name, value|
- [@rss10, @rss20].each do |rss|
- meth = "#{RSS::CONTENT_PREFIX}_#{name}"
- parent = rss.items.last
- assert_equal(value, parent.__send__(meth))
- parent.__send__("#{meth}=", new_value[name].to_s)
- assert_equal(new_value[name], parent.__send__(meth))
- end
- end
- end
-
- def test_to_s
- @elems.each do |name, value|
- excepted = make_element("#{@prefix}:#{name}", {}, value)
- meth = "#{RSS::CONTENT_PREFIX}_#{name}_element"
- [@rss10, @rss20].each do |rss|
- assert_equal(excepted, rss.items.last.__send__(meth))
- end
- end
-
- [@rss10_source, @rss20_source].each do |source|
- REXML::Document.new(source).root.each_element do |parent|
- next unless parent.name != "item"
- parent.each_element do |elem|
- if elem.namespace == @uri
- assert_equal(elem.text, @elems[elem.name.intern].to_s)
- end
- end
- end
- end
- end
- end
-end