# -*- tab-width: 2 -*- vim: ts=2
require 'my-assertions'
module TestRSSMixin
include RSS
XMLDECL_VERSION = "1.0"
XMLDECL_ENCODING = "UTF-8"
XMLDECL_STANDALONE = "no"
RDF_ABOUT = "http://www.xml.com/xml/news.rss"
RDF_RESOURCE = "http://xml.com/universal/images/xml_tiny.gif"
TITLE_VALUE = "XML.com"
LINK_VALUE = "http://xml.com/pub"
URL_VALUE = "http://xml.com/universal/images/xml_tiny.gif"
NAME_VALUE = "hogehoge"
DESCRIPTION_VALUE = "
XML.com features a rich mix of information and services
for the XML community.
"
RESOURCES = [
"http://xml.com/pub/2000/08/09/xslt/xslt.html",
"http://xml.com/pub/2000/08/09/rdfdb/index.html",
]
private
def make_xmldecl(v=XMLDECL_VERSION, e=XMLDECL_ENCODING, s=XMLDECL_STANDALONE)
rv = ""
rv
end
def make_RDF(content=nil, xmlns=[])
<<-EORSS
#{make_xmldecl}
#{block_given? ? yield : content}
EORSS
end
def make_channel(content=nil)
<<-EOC
#{TITLE_VALUE}
#{LINK_VALUE}
#{DESCRIPTION_VALUE}
#{RESOURCES.collect do |res| '' end.join("\n")}
#{block_given? ? yield : content}
EOC
end
def make_image(content=nil)
<<-EOI
#{TITLE_VALUE}
#{URL_VALUE}
#{LINK_VALUE}
#{block_given? ? yield : content}
EOI
end
def make_item(content=nil)
<<-EOI
-
#{TITLE_VALUE}
#{LINK_VALUE}
#{DESCRIPTION_VALUE}
#{block_given? ? yield : content}
EOI
end
def make_textinput(content=nil)
<<-EOT
#{TITLE_VALUE}
#{DESCRIPTION_VALUE}
#{NAME_VALUE}
#{LINK_VALUE}
#{block_given? ? yield : content}
EOT
end
end