2004-10-31 09:14:21 -05:00
|
|
|
require "rss-testcase"
|
|
|
|
|
|
|
|
require "rss/maker"
|
|
|
|
|
|
|
|
module RSS
|
|
|
|
class TestMakerXMLStyleSheet < TestCase
|
|
|
|
|
2004-11-03 01:43:18 -05:00
|
|
|
def test_xml_stylesheet
|
2004-10-31 09:14:21 -05:00
|
|
|
href = 'a.xsl'
|
|
|
|
type = 'text/xsl'
|
|
|
|
title = 'sample'
|
|
|
|
media = 'printer'
|
|
|
|
charset = 'UTF-8'
|
|
|
|
alternate = 'yes'
|
|
|
|
|
|
|
|
rss = RSS::Maker.make("1.0") do |maker|
|
2007-03-17 06:13:25 -04:00
|
|
|
maker.xml_stylesheets.new_xml_stylesheet do |xss|
|
|
|
|
xss.href = href
|
|
|
|
xss.type = type
|
|
|
|
xss.title = title
|
|
|
|
xss.media = media
|
|
|
|
xss.charset = charset
|
|
|
|
xss.alternate = alternate
|
|
|
|
end
|
|
|
|
|
2004-10-31 09:14:21 -05:00
|
|
|
setup_dummy_channel(maker)
|
2007-03-17 06:13:25 -04:00
|
|
|
setup_dummy_item(maker)
|
2004-10-31 09:14:21 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
xss = rss.xml_stylesheets.first
|
|
|
|
assert_equal(href, xss.href)
|
|
|
|
assert_equal(type, xss.type)
|
|
|
|
assert_equal(title, xss.title)
|
|
|
|
assert_equal(media, xss.media)
|
|
|
|
assert_equal(charset, xss.charset)
|
|
|
|
assert_equal(alternate, xss.alternate)
|
2004-11-01 08:30:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
href = 'http://example.com/index.xsl'
|
|
|
|
type = 'text/xsl'
|
|
|
|
rss = RSS::Maker.make("1.0") do |maker|
|
2007-08-04 23:03:05 -04:00
|
|
|
maker.xml_stylesheets.new_xml_stylesheet do |_xss|
|
|
|
|
_xss.href = href
|
2007-03-17 06:13:25 -04:00
|
|
|
end
|
|
|
|
|
2004-11-01 08:30:08 -05:00
|
|
|
setup_dummy_channel(maker)
|
2007-03-17 06:13:25 -04:00
|
|
|
setup_dummy_item(maker)
|
2004-11-01 08:30:08 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
xss = rss.xml_stylesheets.first
|
|
|
|
assert_equal(href, xss.href)
|
|
|
|
assert_equal(type, xss.type)
|
2004-10-31 09:14:21 -05:00
|
|
|
end
|
2004-11-03 01:43:18 -05:00
|
|
|
|
|
|
|
def test_not_valid_xml_stylesheet
|
|
|
|
href = 'xss.XXX'
|
|
|
|
type = "text/xsl"
|
|
|
|
|
|
|
|
rss = RSS::Maker.make("1.0") do |maker|
|
2007-03-17 06:13:25 -04:00
|
|
|
maker.xml_stylesheets.new_xml_stylesheet do |xss|
|
|
|
|
# xss.href = href
|
|
|
|
xss.type = type
|
|
|
|
end
|
|
|
|
|
2004-11-03 01:43:18 -05:00
|
|
|
setup_dummy_channel(maker)
|
2007-03-17 06:13:25 -04:00
|
|
|
setup_dummy_item(maker)
|
2004-11-03 01:43:18 -05:00
|
|
|
end
|
|
|
|
assert(rss.xml_stylesheets.empty?)
|
|
|
|
|
|
|
|
rss = RSS::Maker.make("1.0") do |maker|
|
2007-03-17 06:13:25 -04:00
|
|
|
maker.xml_stylesheets.new_xml_stylesheet do |xss|
|
|
|
|
xss.href = href
|
|
|
|
# xss.type = type
|
|
|
|
end
|
|
|
|
|
2004-11-03 01:43:18 -05:00
|
|
|
setup_dummy_channel(maker)
|
2007-03-17 06:13:25 -04:00
|
|
|
setup_dummy_item(maker)
|
2004-11-03 01:43:18 -05:00
|
|
|
end
|
|
|
|
assert(rss.xml_stylesheets.empty?)
|
|
|
|
end
|
2004-10-31 09:14:21 -05:00
|
|
|
|
|
|
|
end
|
|
|
|
end
|