~ubuntu-branches/ubuntu/trusty/ruby1.9/trusty

« back to all changes in this revision

Viewing changes to test/rss/test_taxonomy.rb

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2008-01-24 11:42:29 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20080124114229-jw2f87rdxlq6gp11
Tags: 1.9.0.0-2ubuntu1
* Merge from debian unstable, remaining changes:
  - Robustify check for target_os, fixing build failure on lpia.

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
    def test_to_s
141
141
      @topics_parents.each do |parent|
142
142
        meth = "taxo_topics_element"
143
 
        assert_equal(@topics_node, @rss.__send__(parent).__send!(meth))
 
143
        assert_equal(@topics_node, @rss.__send__(parent).__send__(meth))
144
144
      end
145
145
 
146
146
      @topic_nodes.each_with_index do |node, i|
147
 
        expected = REXML::Document.new(node).root
148
 
        actual = REXML::Document.new(@rss.taxo_topics[i].to_s(true, "")).root
 
147
        expected_xml = taxo_xmlns_container(node)
 
148
        expected = REXML::Document.new(expected_xml).root.elements[1]
 
149
        actual_xml = taxo_xmlns_container(@rss.taxo_topics[i].to_s(true, ""))
 
150
        actual = REXML::Document.new(actual_xml).root.elements[1]
149
151
        expected_elems = expected.reject {|x| x.is_a?(REXML::Text)}
150
152
        actual_elems = actual.reject {|x| x.is_a?(REXML::Text)}
151
153
        expected_elems.sort! {|x, y| x.name <=> y.name}
155
157
        assert_equal(expected.attributes.sort, actual.attributes.sort)
156
158
      end
157
159
    end
 
160
 
 
161
    private
 
162
    def taxo_xmlns_container(content)
 
163
      xmlns_container({
 
164
                        @prefix => @uri,
 
165
                        "dc" => "http://purl.org/dc/elements/1.1/",
 
166
                        "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
 
167
                      },
 
168
                      content)
 
169
    end
158
170
  end
159
171
end
160
172