summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-12-24 09:58:57 +0000
committer(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-12-24 09:58:57 +0000
commitd3944897abfbf8bf5101df6f11e86316e961e316 (patch)
treec5a72b0c37c3b762bc095ae257eeb789e0b76eda
parent0594128b55eec022a268adbe11cc75c1be5c1582 (diff)
This commit was manufactured by cvs2svn to create tag 'v1_8_4'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_8_4@9735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/tk/tkutil/.cvsignore3
-rw-r--r--lib/rss/maker/taxonomy.rb178
-rw-r--r--test/rss/test_2.0.rb394
-rw-r--r--test/rss/test_maker_taxo.rb79
-rw-r--r--test/rss/test_taxonomy.rb160
5 files changed, 0 insertions, 814 deletions
diff --git a/ext/tk/tkutil/.cvsignore b/ext/tk/tkutil/.cvsignore
deleted file mode 100644
index 90c83ed..0000000
--- a/ext/tk/tkutil/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-*.log
-*.def
diff --git a/lib/rss/maker/taxonomy.rb b/lib/rss/maker/taxonomy.rb
deleted file mode 100644
index 2e54ea6..0000000
--- a/lib/rss/maker/taxonomy.rb
+++ /dev/null
@@ -1,178 +0,0 @@
-require 'rss/taxonomy'
-require 'rss/maker/1.0'
-require 'rss/maker/dublincore'
-
-module RSS
- module Maker
- module TaxonomyTopicsModel
- def self.append_features(klass)
- super
-
- klass.add_need_initialize_variable("taxo_topics", "make_taxo_topics")
- klass.add_other_element("taxo_topics")
- klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
- attr_reader :taxo_topics
- def make_taxo_topics
- self.class::TaxonomyTopics.new(@maker)
- end
-
- def setup_taxo_topics(rss, current)
- @taxo_topics.to_rss(rss, current)
- end
-EOC
- end
-
- def self.install_taxo_topics(klass)
- klass.module_eval(<<-EOC, *Utils.get_file_and_line_from_caller(1))
- class TaxonomyTopics < TaxonomyTopicsBase
- def to_rss(rss, current)
- if current.respond_to?(:taxo_topics)
- topics = current.class::TaxonomyTopics.new
- bag = topics.Bag
- @resources.each do |resource|
- bag.lis << RDF::Bag::Li.new(resource)
- end
- current.taxo_topics = topics
- end
- end
- end
-EOC
- end
-
- class TaxonomyTopicsBase
- include Base
-
- attr_reader :resources
- def_array_element("resources")
- end
- end
-
- module TaxonomyTopicModel
- def self.append_features(klass)
- super
-
- klass.add_need_initialize_variable("taxo_topics", "make_taxo_topics")
- klass.add_other_element("taxo_topics")
- klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
- attr_reader :taxo_topics
- def make_taxo_topics
- self.class::TaxonomyTopics.new(@maker)
- end
-
- def setup_taxo_topics(rss, current)
- @taxo_topics.to_rss(rss, current)
- end
-
- def taxo_topic
- @taxo_topics[0] and @taxo_topics[0].value
- end
-
- def taxo_topic=(new_value)
- @taxo_topic[0] = self.class::TaxonomyTopic.new(self)
- @taxo_topic[0].value = new_value
- end
-EOC
- end
-
- def self.install_taxo_topic(klass)
- klass.module_eval(<<-EOC, *Utils.get_file_and_line_from_caller(1))
- class TaxonomyTopics < TaxonomyTopicsBase
- class TaxonomyTopic < TaxonomyTopicBase
- DublinCoreModel.install_dublin_core(self)
- TaxonomyTopicsModel.install_taxo_topics(self)
-
- def to_rss(rss, current)
- if current.respond_to?(:taxo_topics)
- topic = current.class::TaxonomyTopic.new(value)
- topic.taxo_link = value
- taxo_topics.to_rss(rss, topic) if taxo_topics
- current.taxo_topics << topic
- setup_other_elements(rss)
- end
- end
-
- def current_element(rss)
- super.taxo_topics.last
- end
- end
- end
-EOC
- end
-
- class TaxonomyTopicsBase
- include Base
-
- def_array_element("taxo_topics")
-
- def new_taxo_topic
- taxo_topic = self.class::TaxonomyTopic.new(self)
- @taxo_topics << taxo_topic
- taxo_topic
- end
-
- def to_rss(rss, current)
- @taxo_topics.each do |taxo_topic|
- taxo_topic.to_rss(rss, current)
- end
- end
-
- class TaxonomyTopicBase
- include Base
- include DublinCoreModel
- include TaxonomyTopicsModel
-
- attr_accessor :value
- add_need_initialize_variable("value")
- alias_method(:taxo_link, :value)
- alias_method(:taxo_link=, :value=)
-
- def have_required_values?
- @value
- end
- end
- end
- end
-
- class RSSBase
- include TaxonomyTopicModel
- end
-
- class ChannelBase
- include TaxonomyTopicsModel
- end
-
- class ItemsBase
- class ItemBase
- include TaxonomyTopicsModel
- end
- end
-
- class RSS10
- TaxonomyTopicModel.install_taxo_topic(self)
-
- class Channel
- TaxonomyTopicsModel.install_taxo_topics(self)
- end
-
- class Items
- class Item
- TaxonomyTopicsModel.install_taxo_topics(self)
- end
- end
- end
-
- class RSS09
- TaxonomyTopicModel.install_taxo_topic(self)
-
- class Channel
- TaxonomyTopicsModel.install_taxo_topics(self)
- end
-
- class Items
- class Item
- TaxonomyTopicsModel.install_taxo_topics(self)
- end
- end
- end
- end
-end
diff --git a/test/rss/test_2.0.rb b/test/rss/test_2.0.rb
deleted file mode 100644
index 2027e53..0000000
--- a/test/rss/test_2.0.rb
+++ /dev/null
@@ -1,394 +0,0 @@
-require "rexml/document"
-
-require "rss-testcase"
-
-require "rss/2.0"
-
-module RSS
- class TestRSS20Core < TestCase
-
- def setup
- @rss_version = "2.0"
- end
-
- def test_Rss
- version = "1.0"
- encoding = "UTF-8"
- standalone = false
-
- rss = Rss.new(@rss_version, version, encoding, standalone)
-
- doc = REXML::Document.new(rss.to_s(false))
-
- xmldecl = doc.xml_decl
-
- %w(version encoding).each do |x|
- assert_equal(instance_eval(x), xmldecl.__send__(x))
- end
- assert_equal(standalone, !xmldecl.standalone.nil?)
-
- assert_equal("", doc.root.namespace)
- assert_equal(@rss_version, doc.root.attributes["version"])
- end
-
- def test_not_displayed_xml_stylesheets
- rss = Rss.new(@rss_version)
- plain_rss = rss.to_s
- 3.times do
- rss.xml_stylesheets.push(XMLStyleSheet.new)
- assert_equal(plain_rss, rss.to_s)
- end
- end
-
- def test_xml_stylesheets
- [
- [{:href => "a.xsl", :type => "text/xsl"}],
- [
- {:href => "a.xsl", :type => "text/xsl"},
- {:href => "a.css", :type => "text/css"},
- ],
- ].each do |attrs_ary|
- assert_xml_stylesheet_pis(attrs_ary, Rss.new(@rss_version))
- end
- end
-
- def test_channel
- title = "fugafuga"
- link = "http://hoge.com"
- description = "fugafugafugafuga"
-
- language = "en-us"
- copyright = "Copyright 2002, Spartanburg Herald-Journal"
- managingEditor = "geo@herald.com (George Matesky)"
- webMaster = "betty@herald.com (Betty Guernsey)"
- pubDate = Time.parse("Sat, 07 Sep 2002 00:00:01 GMT")
- lastBuildDate = Time.parse("Sat, 07 Sep 2002 09:42:31 GMT")
- categories = [
- {
- :content => "Newspapers",
- },
- {
- :domain => "Syndic8",
- :content => "1765",
- }
- ]
- generator = "MightyInHouse Content System v2.3"
- docs = "http://blogs.law.harvard.edu/tech/rss"
-
- ttl = "60"
-
- 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))'
-
- channel = Rss::Channel.new
-
- elems = %w(title link description language copyright
- managingEditor webMaster pubDate lastBuildDate
- generator docs ttl rating)
- elems.each do |x|
- value = instance_eval(x)
- value = value.rfc822 if %w(pubDate lastBuildDate).include?(x)
- channel.__send__("#{x}=", value)
- end
- categories.each do |cat|
- channel.categories << Rss::Channel::Category.new(cat[:domain],
- cat[:content])
- end
-
- doc = REXML::Document.new(make_rss20(channel.to_s))
- c = doc.root.elements[1]
-
- elems.each do |x|
- elem = c.elements[x]
- assert_equal(x, elem.name)
- assert_equal("", elem.namespace)
- expected = instance_eval(x)
- case x
- when "pubDate", "lastBuildDate"
- assert_equal(expected, Time.parse(elem.text))
- when "ttl"
- expected = channel.__send__(x)
- assert_equal(expected, elem.text.to_i)
- else
- assert_equal(expected, elem.text)
- end
- end
- categories.each_with_index do |cat, i|
- cat = cat.dup
- cat[:domain] ||= nil
- category = c.elements["category[#{i+1}]"]
- actual = {
- :domain => category.attributes["domain"],
- :content => category.text,
- }
- assert_equal(cat, actual)
- end
- end
-
- def test_channel_cloud
- cloud_params = {
- :domain => "rpc.sys.com",
- :port => "80",
- :path => "/RPC2",
- :registerProcedure => "myCloud.rssPleaseNotify",
- :protocol => "xml-rpc",
- }
- cloud = Rss::Channel::Cloud.new(cloud_params[:domain],
- cloud_params[:port],
- cloud_params[:path],
- cloud_params[:registerProcedure],
- cloud_params[:protocol])
- cloud_params[:port] = cloud.port
-
- doc = REXML::Document.new(cloud.to_s)
- cloud_elem = doc.root
-
- actual = {}
- cloud_elem.attributes.each do |name, value|
- value = value.to_i if name == "port"
- actual[name.intern] = value
- end
- assert_equal(cloud_params, actual)
- end
-
- def test_channel_image
- image_params = {
- :url => "http://hoge.com/hoge.png",
- :title => "fugafuga",
- :link => "http://hoge.com",
- :width => "144",
- :height => "400",
- :description => "an image",
- }
- image = Rss::Channel::Image.new(image_params[:url],
- image_params[:title],
- image_params[:link],
- image_params[:width],
- image_params[:height],
- image_params[:description])
-
- doc = REXML::Document.new(image.to_s)
- image_elem = doc.root
-
- image_params.each do |name, value|
- value = image.__send__(name)
- actual = image_elem.elements[name.to_s].text
- actual = actual.to_i if [:width, :height].include?(name)
- assert_equal(value, actual)
- end
- end
-
- def test_channel_textInput
- textInput_params = {
- :title => "fugafuga",
- :description => "text hoge fuga",
- :name => "hoge",
- :link => "http://hoge.com",
- }
- textInput = Rss::Channel::TextInput.new(textInput_params[:title],
- textInput_params[:description],
- textInput_params[:name],
- textInput_params[:link])
-
- doc = REXML::Document.new(textInput.to_s)
- input_elem = doc.root
-
- textInput_params.each do |name, value|
- actual = input_elem.elements[name.to_s].text
- assert_equal(value, actual)
- end
- end
-
- def test_channel_skip_days
- skipDays_values = [
- "Sunday",
- "Monday",
- ]
- skipDays = Rss::Channel::SkipDays.new
- skipDays_values.each do |value|
- skipDays.days << Rss::Channel::SkipDays::Day.new(value)
- end
-
- doc = REXML::Document.new(skipDays.to_s)
- days_elem = doc.root
-
- skipDays_values.each_with_index do |value, i|
- assert_equal(value, days_elem.elements[i + 1].text)
- end
- end
-
- def test_channel_skip_hours
- skipHours_values = [
- "0",
- "13",
- ]
- skipHours = Rss::Channel::SkipHours.new
- skipHours_values.each do |value|
- skipHours.hours << Rss::Channel::SkipHours::Hour.new(value)
- end
-
- doc = REXML::Document.new(skipHours.to_s)
- hours_elem = doc.root
-
- skipHours_values.each_with_index do |value, i|
- expected = skipHours.hours[i].content
- assert_equal(expected, hours_elem.elements[i + 1].text.to_i)
- end
- end
-
- def test_item
- title = "fugafuga"
- link = "http://hoge.com/"
- description = "text hoge fuga"
- author = "oprah@oxygen.net"
- categories = [
- {
- :content => "Newspapers",
- },
- {
- :domain => "Syndic8",
- :content => "1765",
- }
- ]
- comments = "http://www.myblog.org/cgi-local/mt/mt-comments.cgi?entry_id=290"
- pubDate = Time.parse("Sat, 07 Sep 2002 00:00:01 GMT")
-
- channel = Rss::Channel.new
- item = Rss::Channel::Item.new
- channel.items << item
-
- elems = %w(title link description author comments pubDate)
- elems.each do |x|
- value = instance_eval(x)
- value = value.rfc822 if x == "pubDate"
- item.__send__("#{x}=", value)
- end
- categories.each do |cat|
- item.categories << Rss::Channel::Category.new(cat[:domain],
- cat[:content])
- end
-
- doc = REXML::Document.new(channel.to_s)
- channel_elem = doc.root
-
- item_elem = channel_elem.elements["item[1]"]
- elems.each do |x|
- elem = item_elem.elements[x]
- assert_equal(x, elem.name)
- assert_equal("", elem.namespace)
- expected = instance_eval(x)
- case x
- when "pubDate"
- assert_equal(expected, Time.parse(elem.text))
- else
- assert_equal(expected, elem.text)
- end
- end
- categories.each_with_index do |cat, i|
- cat = cat.dup
- cat[:domain] ||= nil
- category = item_elem.elements["category[#{i+1}]"]
- actual = {
- :domain => category.attributes["domain"],
- :content => category.text,
- }
- assert_equal(cat, actual)
- end
- end
-
- def test_item_enclosure
- enclosure_params = {
- :url => "http://www.scripting.com/mp3s/weatherReportSuite.mp3",
- :length => "12216320",
- :type => "audio/mpeg",
- }
-
- enclosure = Rss::Channel::Item::Enclosure.new(enclosure_params[:url],
- enclosure_params[:length],
- enclosure_params[:type])
- enclosure_params[:length] = enclosure.length
-
- doc = REXML::Document.new(enclosure.to_s)
- enclosure_elem = doc.root
-
- actual = {}
- enclosure_elem.attributes.each do |name, value|
- value = value.to_i if name == "length"
- actual[name.intern] = value
- end
- assert_equal(enclosure_params, actual)
- end
-
- def test_item_guid
- test_params = [
- {
- :content => "http://some.server.com/weblogItem3207",
- },
- {
- :isPermaLink => "true",
- :content => "http://inessential.com/2002/09/01.php#a2",
- },
- ]
-
- test_params.each do |guid_params|
- guid = Rss::Channel::Item::Guid.new(guid_params[:isPermaLink],
- guid_params[:content])
- if guid_params.has_key?(:isPermaLink)
- guid_params[:isPermaLink] = guid.isPermaLink
- end
- if guid.isPermaLink.nil?
- assert_equal(true, guid.PermaLink?)
- else
- assert_equal(guid.isPermaLink, guid.PermaLink?)
- end
-
- doc = REXML::Document.new(guid.to_s)
- guid_elem = doc.root
-
- actual = {}
- actual[:content] = guid_elem.text if guid_elem.text
- guid_elem.attributes.each do |name, value|
- value = value == "true" if name == "isPermaLink"
- actual[name.intern] = value
- end
- assert_equal(guid_params, actual)
- end
- end
-
- def test_item_source
- source_params = {
- :url => "http://www.tomalak.org/links2.xml",
- :content => "Tomalak's Realm",
- }
-
- source = Rss::Channel::Item::Source.new(source_params[:url],
- source_params[:content])
-
- doc = REXML::Document.new(source.to_s)
- source_elem = doc.root
-
- actual = {}
- actual[:content] = source_elem.text
- source_elem.attributes.each do |name, value|
- actual[name.intern] = value
- end
- assert_equal(source_params, actual)
- end
-
- def test_indent_size
- assert_equal(0, Rss.indent_size)
- assert_equal(1, Rss::Channel.indent_size)
- assert_equal(2, Rss::Channel::SkipDays.indent_size)
- assert_equal(3, Rss::Channel::SkipDays::Day.indent_size)
- assert_equal(2, Rss::Channel::SkipHours.indent_size)
- assert_equal(3, Rss::Channel::SkipHours::Hour.indent_size)
- assert_equal(2, Rss::Channel::Image.indent_size)
- assert_equal(2, Rss::Channel::Cloud.indent_size)
- assert_equal(2, Rss::Channel::Item.indent_size)
- assert_equal(3, Rss::Channel::Item::Source.indent_size)
- assert_equal(3, Rss::Channel::Item::Enclosure.indent_size)
- assert_equal(3, Rss::Channel::Item::Category.indent_size)
- assert_equal(3, Rss::Channel::Item::Guid.indent_size)
- assert_equal(2, Rss::Channel::TextInput.indent_size)
- end
- end
-end
diff --git a/test/rss/test_maker_taxo.rb b/test/rss/test_maker_taxo.rb
deleted file mode 100644
index 1c7d284..0000000
--- a/test/rss/test_maker_taxo.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-require "rss-testcase"
-
-require "rss/maker"
-
-module RSS
- class TestMakerTaxonomy < TestCase
-
- def setup
- @uri = "http://purl.org/rss/1.0/modules/taxonomy/"
-
- @resources = [
- "http://meerkat.oreillynet.com/?c=cat23",
- "http://meerkat.oreillynet.com/?c=47",
- "http://dmoz.org/Computers/Data_Formats/Markup_Languages/XML/",
- ]
-
- @topics = [
- {
- :link => "http://meerkat.oreillynet.com/?c=cat23",
- :title => "Data: XML",
- :description => "A Meerkat channel",
- },
- {
- :link => "http://dmoz.org/Computers/Data_Formats/Markup_Languages/XML/",
- :title => "XML",
- :subject => "XML",
- :description => "DMOZ category",
- :topics => [
- "http://meerkat.oreillynet.com/?c=cat23",
- "http://dmoz.org/Computers/Data_Formats/Markup_Languages/SGML/",
- "http://dmoz.org/Computers/Programming/Internet/",
- ]
- },
- ]
- end
-
- def test_rss10
- rss = RSS::Maker.make("1.0") do |maker|
- setup_dummy_channel(maker)
- set_topics(maker.channel)
-
- setup_dummy_item(maker)
- set_topics(maker.items.last)
-
- setup_taxo_topic(maker, @topics)
- end
- assert_equal(@resources, rss.channel.taxo_topics.resources)
- assert_equal(@resources, rss.items.last.taxo_topics.resources)
- assert_taxo_topic(@topics, rss)
- end
-
- def _test_date
- t1 = Time.iso8601("2000-01-01T12:00:05+00:00")
- t2 = Time.iso8601("2005-01-01T12:00:05+00:00")
-
- rss = RSS::Maker.make("1.0") do |maker|
- setup_dummy_channel(maker)
- maker.channel.date = t1
- date = maker.channel.dc_dates.new_date
- date.value = t2
-
- setup_dummy_item(maker)
- item = maker.items.last
- item.date = t2
- date = item.dc_dates.new_date
- date.value = t1
- end
- assert_equal([t1, t2], rss.channel.dc_dates.collect{|x| x.value})
- assert_equal([t2, t1], rss.items.last.dc_dates.collect{|x| x.value})
- end
-
- private
- def set_topics(target, resources=@resources)
- resources.each do |value|
- target.taxo_topics << value
- end
- end
- end
-end
diff --git a/test/rss/test_taxonomy.rb b/test/rss/test_taxonomy.rb
deleted file mode 100644
index b4950c0..0000000
--- a/test/rss/test_taxonomy.rb
+++ /dev/null
@@ -1,160 +0,0 @@
-require "cgi"
-
-require "rss-testcase"
-
-require "rss/1.0"
-require "rss/2.0"
-require "rss/taxonomy"
-
-module RSS
- class TestTaxonomy < TestCase
-
- def setup
- @prefix = "taxo"
- @uri = "http://purl.org/rss/1.0/modules/taxonomy/"
- @dc_prefix = "dc"
- @dc_uri = "http://purl.org/dc/elements/1.1/"
-
- @ns = {
- @prefix => @uri,
- @dc_prefix => @dc_uri,
- }
-
- @topics_parents = %w(channel item)
-
- @topics_lis = [
- "http://meerkat.oreillynet.com/?c=cat23",
- "http://meerkat.oreillynet.com/?c=47",
- "http://dmoz.org/Computers/Data_Formats/Markup_Languages/XML/",
- ]
-
- @topics_node = "<#{@prefix}:topics>\n"
- @topics_node << " <rdf:Bag>\n"
- @topics_lis.each do |value|
- resource = CGI.escapeHTML(value)
- @topics_node << " <rdf:li resource=\"#{resource}\"/>\n"
- end
- @topics_node << " </rdf:Bag>\n"
- @topics_node << "</#{@prefix}:topics>"
-
- @topic_topics_lis = \
- [
- "http://meerkat.oreillynet.com/?c=cat23",
- "http://dmoz.org/Computers/Data_Formats/Markup_Languages/SGML/",
- "http://dmoz.org/Computers/Programming/Internet/",
- ]
-
- @topic_contents = \
- [
- {
- :link => "http://meerkat.oreillynet.com/?c=cat23",
- :title => "Data: XML",
- :description => "A Meerkat channel",
- },
- {
- :link => "http://dmoz.org/Computers/Data_Formats/Markup_Languages/XML/",
- :title => "XML",
- :subject => "XML",
- :description => "DMOZ category",
- :topics => @topic_topics_lis,
- }
- ]
-
- @topic_nodes = @topic_contents.collect do |info|
- link = info[:link]
- rv = "<#{@prefix}:topic rdf:about=\"#{link}\">\n"
- info.each do |name, value|
- case name
- when :topics
- rv << " <#{@prefix}:topics>\n"
- rv << " <rdf:Bag>\n"
- value.each do |li|
- resource = CGI.escapeHTML(li)
- rv << " <rdf:li resource=\"#{resource}\"/>\n"
- end
- rv << " </rdf:Bag>\n"
- rv << " </#{@prefix}:topics>\n"
- else
- prefix = (name == :link ? @prefix : @dc_prefix)
- rv << " <#{prefix}:#{name}>#{value}</#{prefix}:#{name}>\n"
- end
- end
- rv << "</#{@prefix}:topic>"
- end
-
- @rss_source = make_RDF(<<-EOR, @ns)
-#{make_channel(@topics_node)}
-#{make_image()}
-#{make_item(@topics_node)}
-#{make_textinput()}
-#{@topic_nodes.join("\n")}
-EOR
-
- @rss = Parser.parse(@rss_source)
- end
-
- def test_parser
- assert_nothing_raised do
- Parser.parse(@rss_source)
- end
-
- assert_too_much_tag("topics", "channel") do
- Parser.parse(make_RDF(<<-EOR, @ns))
-#{make_channel(@topics_node * 2)}
-#{make_item()}
-EOR
- end
-
- assert_too_much_tag("topics", "item") do
- Parser.parse(make_RDF(<<-EOR, @ns))
-#{make_channel()}
-#{make_item(@topics_node * 2)}
-EOR
- end
- end
-
- def test_accessor
- topics = @rss.channel.taxo_topics
- assert_equal(@topics_lis.sort,
- topics.Bag.lis.collect {|li| li.resource}.sort)
- assert_equal(@topics_lis.sort, topics.resources.sort)
-
- assert_equal(@rss.taxo_topics.first, @rss.taxo_topic)
-
- @topic_contents.each_with_index do |info, i|
- topic = @rss.taxo_topics[i]
- info.each do |name, value|
- case name
- when :link
- assert_equal(value, topic.about)
- assert_equal(value, topic.taxo_link)
- when :topics
- assert_equal(value.sort, topic.taxo_topics.resources.sort)
- else
- assert_equal(value, topic.__send__("dc_#{name}"))
- end
- end
- end
- end
-
- def test_to_s
- @topics_parents.each do |parent|
- meth = "taxo_topics_element"
- assert_equal(@topics_node, @rss.__send__(parent).funcall(meth))
- end
-
- @topic_nodes.each_with_index do |node, i|
- expected = REXML::Document.new(node).root
- actual = REXML::Document.new(@rss.taxo_topics[i].to_s(true, "")).root
- expected_elems = expected.reject {|x| x.is_a?(REXML::Text)}
- actual_elems = actual.reject {|x| x.is_a?(REXML::Text)}
- expected_elems.sort! {|x, y| x.name <=> y.name}
- actual_elems.sort! {|x, y| x.name <=> y.name}
- assert_equal(expected_elems.collect {|x| x.to_s},
- actual_elems.collect {|x| x.to_s})
- assert_equal(expected.attributes.sort, actual.attributes.sort)
- end
- end
- end
-end
-