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

« back to all changes in this revision

Viewing changes to test/rss/test_image.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:
173
173
 
174
174
    def test_favicon_to_s
175
175
      favicon = @rss.channel.image_favicon
176
 
      expected = REXML::Document.new(make_element("#{@prefix}:favicon",
177
 
                                                  @favicon_attrs,
178
 
                                                  @favicon_contents))
179
 
      actual = REXML::Document.new(favicon.to_s(false, ""))
 
176
      expected_xml = image_xmlns_container(make_element("#{@prefix}:favicon",
 
177
                                                        @favicon_attrs,
 
178
                                                        @favicon_contents))
 
179
      expected = REXML::Document.new(expected_xml)
 
180
      actual_xml = image_xmlns_container(favicon.to_s(false, ""))
 
181
      actual = REXML::Document.new(actual_xml)
180
182
      assert_equal(expected.to_s, actual.to_s)
181
183
    end
182
184
 
183
185
    def test_item_to_s
184
186
      @rss.items.each_with_index do |item, i|
185
187
        attrs, contents = @items[i]
186
 
        expected_s = make_element("#{@prefix}:item", attrs, contents)
187
 
        expected = REXML::Document.new(expected_s)
188
 
        actual = REXML::Document.new(item.image_item.to_s(false, ""))
 
188
        expected_xml = make_element("#{@prefix}:item", attrs, contents)
 
189
        expected_xml = image_xmlns_container(expected_xml)
 
190
        expected = REXML::Document.new(expected_xml)
 
191
        actual_xml = image_xmlns_container(item.image_item.to_s(false, ""))
 
192
        actual = REXML::Document.new(actual_xml)
189
193
 
190
194
        assert_equal(expected[0].attributes, actual[0].attributes)
191
195
 
197
201
      end
198
202
    end
199
203
 
 
204
    private
 
205
    def image_xmlns_container(content)
 
206
      xmlns_container({
 
207
                        @prefix => @uri,
 
208
                        "dc" => "http://purl.org/dc/elements/1.1/",
 
209
                        "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
 
210
                      },
 
211
                      content)
 
212
    end
200
213
  end
201
214
end