2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2005-02-03 10:31:57 -05:00
|
|
|
require "erb"
|
2004-01-28 01:09:27 -05:00
|
|
|
|
2004-03-21 05:03:17 -05:00
|
|
|
require "test/unit"
|
2013-02-24 08:10:46 -05:00
|
|
|
require_relative 'rss-assertions'
|
2004-03-21 05:03:17 -05:00
|
|
|
|
2007-03-17 06:13:25 -04:00
|
|
|
require "rss"
|
|
|
|
|
2004-03-21 05:03:17 -05:00
|
|
|
module RSS
|
2004-10-16 00:51:15 -04:00
|
|
|
class TestCase < Test::Unit::TestCase
|
2005-02-03 10:31:57 -05:00
|
|
|
include ERB::Util
|
2004-10-16 00:51:15 -04:00
|
|
|
|
|
|
|
include RSS
|
|
|
|
include Assertions
|
|
|
|
|
|
|
|
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"
|
|
|
|
LANGUAGE_VALUE = "ja"
|
|
|
|
DESCRIPTION_VALUE = "
|
2007-03-17 06:13:25 -04:00
|
|
|
XML.com features a rich mix of information and services
|
2004-01-27 22:46:13 -05:00
|
|
|
for the XML community.
|
2004-10-16 00:51:15 -04:00
|
|
|
"
|
|
|
|
RESOURCES = [
|
|
|
|
"http://xml.com/pub/2000/08/09/xslt/xslt.html",
|
|
|
|
"http://xml.com/pub/2000/08/09/rdfdb/index.html",
|
|
|
|
]
|
|
|
|
|
|
|
|
CLOUD_DOMAIN = "data.ourfavoritesongs.com"
|
|
|
|
CLOUD_PORT = "80"
|
|
|
|
CLOUD_PATH = "/RPC2"
|
|
|
|
CLOUD_REGISTER_PROCEDURE = "ourFavoriteSongs.rssPleaseNotify"
|
|
|
|
CLOUD_PROTOCOL = "xml-rpc"
|
2009-03-05 22:56:38 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
ENCLOSURE_URL = "http://www.scripting.com/mp3s/weatherReportSuite.mp3"
|
|
|
|
ENCLOSURE_LENGTH = "12216320"
|
|
|
|
ENCLOSURE_TYPE = "audio/mpeg"
|
2009-03-05 22:56:38 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
CATEGORY_DOMAIN = "http://www.superopendirectory.com/"
|
|
|
|
|
2007-03-17 06:13:25 -04:00
|
|
|
FEED_TITLE = "dive into mark"
|
|
|
|
FEED_UPDATED = "2003-12-13T18:30:02Z"
|
|
|
|
FEED_AUTHOR_NAME = "John Doe"
|
|
|
|
FEED_ID = "urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"
|
|
|
|
|
|
|
|
ENTRY_TITLE = "Atom-Powered Robots Run Amok"
|
|
|
|
ENTRY_LINK = "http://example.org/2003/12/13/atom03"
|
|
|
|
ENTRY_ID = "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"
|
|
|
|
ENTRY_UPDATED = "2003-12-13T18:30:02Z"
|
|
|
|
ENTRY_SUMMARY = "Some text."
|
|
|
|
|
|
|
|
t = Time.iso8601("2000-01-01T12:00:05+00:00")
|
|
|
|
class << t
|
|
|
|
alias_method(:to_s, :iso8601)
|
|
|
|
end
|
|
|
|
|
|
|
|
DC_ELEMENTS = {
|
|
|
|
:title => "hoge",
|
|
|
|
:description =>
|
|
|
|
" XML is placing increasingly heavy loads on
|
|
|
|
the existing technical infrastructure of the Internet.",
|
|
|
|
:creator => "Rael Dornfest (mailto:rael@oreilly.com)",
|
|
|
|
:subject => "XML",
|
|
|
|
:publisher => "The O'Reilly Network",
|
|
|
|
:contributor => "hogehoge",
|
|
|
|
:type => "fugafuga",
|
|
|
|
:format => "hohoho",
|
|
|
|
:identifier => "fufufu",
|
|
|
|
:source => "barbar",
|
|
|
|
:language => "ja",
|
|
|
|
:relation => "cococo",
|
|
|
|
:rights => "Copyright (c) 2000 O'Reilly & Associates, Inc.",
|
|
|
|
:date => t,
|
|
|
|
}
|
|
|
|
|
|
|
|
DC_NODES = DC_ELEMENTS.collect do |name, value|
|
|
|
|
"<#{DC_PREFIX}:#{name}>#{value}</#{DC_PREFIX}:#{name}>"
|
|
|
|
end.join("\n")
|
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
def default_test
|
|
|
|
# This class isn't tested
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def make_xmldecl(v=XMLDECL_VERSION, e=XMLDECL_ENCODING, s=XMLDECL_STANDALONE)
|
|
|
|
rv = "<?xml version='#{v}'"
|
|
|
|
rv << " encoding='#{e}'" if e
|
|
|
|
rv << " standalone='#{s}'" if s
|
|
|
|
rv << "?>"
|
|
|
|
rv
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_RDF(content=nil, xmlns=[])
|
|
|
|
<<-EORSS
|
2004-01-27 22:46:13 -05:00
|
|
|
#{make_xmldecl}
|
|
|
|
<rdf:RDF xmlns="#{URI}" xmlns:rdf="#{RDF::URI}"
|
|
|
|
#{xmlns.collect {|pre, uri| "xmlns:#{pre}='#{uri}'"}.join(' ')}>
|
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</rdf:RDF>
|
|
|
|
EORSS
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
def make_channel(content=nil)
|
|
|
|
<<-EOC
|
2004-01-27 22:46:13 -05:00
|
|
|
<channel rdf:about="#{RDF_ABOUT}">
|
2004-10-16 00:51:15 -04:00
|
|
|
<title>#{TITLE_VALUE}</title>
|
|
|
|
<link>#{LINK_VALUE}</link>
|
|
|
|
<description>#{DESCRIPTION_VALUE}</description>
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
<image rdf:resource="#{RDF_RESOURCE}" />
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
<items>
|
|
|
|
<rdf:Seq>
|
2004-01-27 22:46:13 -05:00
|
|
|
#{RESOURCES.collect do |res| '<rdf:li resource="' + res + '" />' end.join("\n")}
|
2004-10-16 00:51:15 -04:00
|
|
|
</rdf:Seq>
|
|
|
|
</items>
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
<textinput rdf:resource="#{RDF_RESOURCE}" />
|
2004-01-27 22:46:13 -05:00
|
|
|
|
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</channel>
|
|
|
|
EOC
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
def make_image(content=nil)
|
|
|
|
<<-EOI
|
2004-01-27 22:46:13 -05:00
|
|
|
<image rdf:about="#{RDF_ABOUT}">
|
2004-10-16 00:51:15 -04:00
|
|
|
<title>#{TITLE_VALUE}</title>
|
|
|
|
<url>#{URL_VALUE}</url>
|
|
|
|
<link>#{LINK_VALUE}</link>
|
2004-01-27 22:46:13 -05:00
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</image>
|
|
|
|
EOI
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
def make_item(content=nil)
|
|
|
|
<<-EOI
|
2004-01-27 22:46:13 -05:00
|
|
|
<item rdf:about="#{RDF_ABOUT}">
|
2004-10-16 00:51:15 -04:00
|
|
|
<title>#{TITLE_VALUE}</title>
|
|
|
|
<link>#{LINK_VALUE}</link>
|
|
|
|
<description>#{DESCRIPTION_VALUE}</description>
|
2004-01-27 22:46:13 -05:00
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</item>
|
|
|
|
EOI
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
def make_textinput(content=nil)
|
|
|
|
<<-EOT
|
2004-01-27 22:46:13 -05:00
|
|
|
<textinput rdf:about="#{RDF_ABOUT}">
|
2004-10-16 00:51:15 -04:00
|
|
|
<title>#{TITLE_VALUE}</title>
|
|
|
|
<description>#{DESCRIPTION_VALUE}</description>
|
|
|
|
<name>#{NAME_VALUE}</name>
|
|
|
|
<link>#{LINK_VALUE}</link>
|
2004-01-27 22:46:13 -05:00
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</textinput>
|
|
|
|
EOT
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-02-13 06:02:03 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
def make_sample_RDF
|
|
|
|
make_RDF(<<-EOR)
|
2004-03-21 04:20:47 -05:00
|
|
|
#{make_channel}
|
|
|
|
#{make_image}
|
|
|
|
#{make_item}
|
|
|
|
#{make_textinput}
|
|
|
|
EOR
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-03-21 04:20:47 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
def make_rss20(content=nil, xmlns=[])
|
|
|
|
<<-EORSS
|
2004-02-13 06:02:03 -05:00
|
|
|
#{make_xmldecl}
|
|
|
|
<rss version="2.0"
|
|
|
|
#{xmlns.collect {|pre, uri| "xmlns:#{pre}='#{uri}'"}.join(' ')}>
|
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</rss>
|
|
|
|
EORSS
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-02-13 06:02:03 -05:00
|
|
|
|
2007-03-17 06:13:25 -04:00
|
|
|
def make_sample_items20
|
|
|
|
RESOURCES.collect do |res|
|
|
|
|
elems = ["<link>#{res}</link>"]
|
|
|
|
elems << "<title>title of #{res}</title>"
|
|
|
|
elems = elems.join("\n")
|
2012-07-23 17:37:39 -04:00
|
|
|
"<item>\n#{elems}\n</item>"
|
2007-03-17 06:13:25 -04:00
|
|
|
end.join("\n")
|
|
|
|
end
|
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
def make_channel20(content=nil)
|
|
|
|
<<-EOC
|
2004-02-13 06:02:03 -05:00
|
|
|
<channel>
|
2004-10-16 00:51:15 -04:00
|
|
|
<title>#{TITLE_VALUE}</title>
|
|
|
|
<link>#{LINK_VALUE}</link>
|
|
|
|
<description>#{DESCRIPTION_VALUE}</description>
|
|
|
|
<language>#{LANGUAGE_VALUE}</language>
|
2004-02-13 06:02:03 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
<image>
|
|
|
|
<url>#{RDF_RESOURCE}</url>
|
|
|
|
<title>#{TITLE_VALUE}</title>
|
|
|
|
<link>#{LINK_VALUE}</link>
|
|
|
|
</image>
|
2004-02-13 06:02:03 -05:00
|
|
|
|
2007-03-17 06:13:25 -04:00
|
|
|
#{make_sample_items20}
|
2004-02-13 06:02:03 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
<textInput>
|
|
|
|
<title>#{TITLE_VALUE}</title>
|
|
|
|
<description>#{DESCRIPTION_VALUE}</description>
|
|
|
|
<name>#{NAME_VALUE}</name>
|
|
|
|
<link>#{RDF_RESOURCE}</link>
|
|
|
|
</textInput>
|
2004-02-13 06:02:03 -05:00
|
|
|
|
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</channel>
|
|
|
|
EOC
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-02-13 06:02:03 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
def make_item20(content=nil)
|
|
|
|
<<-EOI
|
2004-02-13 06:02:03 -05:00
|
|
|
<item>
|
2004-10-16 00:51:15 -04:00
|
|
|
<title>#{TITLE_VALUE}</title>
|
|
|
|
<link>#{LINK_VALUE}</link>
|
|
|
|
<description>#{DESCRIPTION_VALUE}</description>
|
2004-02-13 06:02:03 -05:00
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</item>
|
|
|
|
EOI
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-07-06 13:43:05 -04:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
def make_cloud20
|
|
|
|
<<-EOC
|
2004-07-06 13:43:05 -04:00
|
|
|
<cloud
|
|
|
|
domain="#{CLOUD_DOMAIN}"
|
|
|
|
port="#{CLOUD_PORT}"
|
|
|
|
path="#{CLOUD_PATH}"
|
|
|
|
registerProcedure="#{CLOUD_REGISTER_PROCEDURE}"
|
|
|
|
protocol="#{CLOUD_PROTOCOL}" />
|
|
|
|
EOC
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-07-06 13:43:05 -04:00
|
|
|
|
2007-03-17 06:13:25 -04:00
|
|
|
def make_sample_rss20
|
|
|
|
make_rss20(<<-EOR)
|
|
|
|
#{make_channel20}
|
|
|
|
EOR
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_feed_without_entry(content=nil, xmlns=[])
|
|
|
|
<<-EOA
|
|
|
|
<feed xmlns="#{Atom::URI}"
|
|
|
|
#{xmlns.collect {|pre, uri| "xmlns:#{pre}='#{uri}'"}.join(' ')}>
|
|
|
|
<id>#{FEED_ID}</id>
|
|
|
|
<title>#{FEED_TITLE}</title>
|
|
|
|
<updated>#{FEED_UPDATED}</updated>
|
|
|
|
<author>
|
|
|
|
<name>#{FEED_AUTHOR_NAME}</name>
|
|
|
|
</author>
|
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</feed>
|
|
|
|
EOA
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_entry(content=nil)
|
|
|
|
<<-EOA
|
|
|
|
<entry>
|
|
|
|
<title>#{ENTRY_TITLE}</title>
|
|
|
|
<id>#{ENTRY_ID}</id>
|
|
|
|
<updated>#{ENTRY_UPDATED}</updated>
|
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</entry>
|
|
|
|
EOA
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_feed_with_open_entry(content=nil, xmlns=[], &block)
|
|
|
|
make_feed_without_entry(<<-EOA, xmlns)
|
|
|
|
#{make_entry(content, &block)}
|
|
|
|
EOA
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_feed_with_open_entry_source(content=nil, xmlns=[])
|
|
|
|
make_feed_with_open_entry(<<-EOA, xmlns)
|
|
|
|
<source>
|
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</source>
|
|
|
|
EOA
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_feed(content=nil, xmlns=[])
|
|
|
|
make_feed_without_entry(<<-EOA, xmlns)
|
|
|
|
<entry>
|
|
|
|
<title>#{ENTRY_TITLE}</title>
|
|
|
|
<link href="#{ENTRY_LINK}"/>
|
|
|
|
<id>#{ENTRY_ID}</id>
|
|
|
|
<updated>#{ENTRY_UPDATED}</updated>
|
|
|
|
<summary>#{ENTRY_SUMMARY}</summary>
|
|
|
|
</entry>
|
|
|
|
#{block_given? ? yield : content}
|
|
|
|
EOA
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_entry_document(content=nil, xmlns=[])
|
|
|
|
<<-EOA
|
|
|
|
<entry xmlns="#{Atom::URI}"
|
|
|
|
#{xmlns.collect {|pre, uri| "xmlns:#{pre}='#{uri}'"}.join(' ')}>
|
|
|
|
<id>#{ENTRY_ID}</id>
|
|
|
|
<title>#{ENTRY_TITLE}</title>
|
|
|
|
<updated>#{ENTRY_UPDATED}</updated>
|
|
|
|
<author>
|
|
|
|
<name>#{FEED_AUTHOR_NAME}</name>
|
|
|
|
</author>
|
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</entry>
|
|
|
|
EOA
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_entry_document_with_open_source(content=nil, xmlns=[])
|
|
|
|
make_entry_document(<<-EOA, xmlns)
|
|
|
|
<source>
|
|
|
|
#{block_given? ? yield : content}
|
|
|
|
</source>
|
|
|
|
EOA
|
|
|
|
end
|
|
|
|
|
2005-02-03 10:31:57 -05:00
|
|
|
def make_element(elem_name, attrs, contents)
|
|
|
|
attrs_str = attrs.collect do |name, value|
|
|
|
|
"#{h name}='#{h value}'"
|
|
|
|
end.join(" ")
|
2007-11-02 07:58:03 -04:00
|
|
|
attrs_str = " #{attrs_str}" unless attrs_str.empty?
|
|
|
|
|
|
|
|
if contents.is_a?(String)
|
|
|
|
contents_str = h(contents)
|
|
|
|
else
|
|
|
|
contents_str = contents.collect do |name, value|
|
|
|
|
"#{Element::INDENT}<#{h name}>#{h value}</#{h name}>"
|
|
|
|
end.join("\n")
|
|
|
|
contents_str = "\n#{contents_str}\n"
|
|
|
|
end
|
|
|
|
|
|
|
|
"<#{h elem_name}#{attrs_str}>#{contents_str}</#{h elem_name}>"
|
2005-02-03 10:31:57 -05:00
|
|
|
end
|
2007-10-07 09:42:22 -04:00
|
|
|
|
|
|
|
def xmlns_container(xmlns_decls, content)
|
|
|
|
attributes = xmlns_decls.collect do |prefix, uri|
|
|
|
|
"xmlns:#{h prefix}=\"#{h uri}\""
|
|
|
|
end.join(" ")
|
|
|
|
"<dummy #{attributes}>#{content}</dummy>"
|
|
|
|
end
|
|
|
|
|
2004-10-31 09:14:21 -05:00
|
|
|
private
|
2007-03-17 06:13:25 -04:00
|
|
|
def setup_rss10(rdf)
|
|
|
|
assert_equal("", rdf.to_s)
|
|
|
|
|
|
|
|
channel = RDF::Channel.new
|
|
|
|
assert_equal("", channel.to_s)
|
|
|
|
channel.about = "http://example.com/index.rdf"
|
|
|
|
channel.title = "title"
|
|
|
|
channel.link = "http://example.com/"
|
|
|
|
channel.description = "description"
|
|
|
|
assert_equal("", channel.to_s)
|
|
|
|
|
|
|
|
item_title = "item title"
|
|
|
|
item_link = "http://example.com/item"
|
|
|
|
channel.items = RDF::Channel::Items.new
|
|
|
|
channel.items.Seq.lis << RDF::Channel::Items::Seq::Li.new(item_link)
|
|
|
|
assert_not_equal("", channel.to_s)
|
|
|
|
|
|
|
|
rdf.channel = channel
|
|
|
|
assert_equal("", rdf.to_s)
|
|
|
|
|
|
|
|
item = RDF::Item.new
|
|
|
|
item.title = item_title
|
|
|
|
item.link = item_link
|
|
|
|
item.about = item_link
|
|
|
|
rdf.items << item
|
|
|
|
assert_not_equal("", rdf.to_s)
|
|
|
|
end
|
2009-03-05 22:56:38 -05:00
|
|
|
|
2007-03-17 06:13:25 -04:00
|
|
|
def setup_rss20(rss)
|
|
|
|
assert_equal("", rss.to_s)
|
|
|
|
|
|
|
|
channel = Rss::Channel.new
|
|
|
|
assert_equal("", channel.to_s)
|
|
|
|
channel.title = "title"
|
|
|
|
channel.link = "http://example.com/"
|
|
|
|
channel.description = "description"
|
|
|
|
assert_not_equal("", channel.to_s)
|
|
|
|
|
|
|
|
rss.channel = channel
|
|
|
|
assert_not_equal("", rss.to_s)
|
|
|
|
end
|
2009-03-05 22:56:38 -05:00
|
|
|
|
2004-10-31 09:14:21 -05:00
|
|
|
def setup_dummy_channel(maker)
|
|
|
|
about = "http://hoge.com"
|
|
|
|
title = "fugafuga"
|
2007-03-17 06:13:25 -04:00
|
|
|
link = "http://hoge.com/feed.xml"
|
2004-10-31 09:14:21 -05:00
|
|
|
description = "fugafugafugafuga"
|
|
|
|
language = "ja"
|
|
|
|
|
|
|
|
maker.channel.about = about
|
|
|
|
maker.channel.title = title
|
|
|
|
maker.channel.link = link
|
|
|
|
maker.channel.description = description
|
|
|
|
maker.channel.language = language
|
|
|
|
end
|
|
|
|
|
2007-03-17 06:13:25 -04:00
|
|
|
def setup_dummy_channel_atom(maker)
|
|
|
|
updated = Time.now
|
|
|
|
author = "Foo"
|
|
|
|
|
|
|
|
setup_dummy_channel(maker)
|
|
|
|
maker.channel.links.first.rel = "self"
|
|
|
|
maker.channel.links.first.type = "application/atom+xml"
|
|
|
|
maker.channel.updated = updated
|
|
|
|
maker.channel.author = author
|
|
|
|
end
|
|
|
|
|
2004-10-31 09:14:21 -05:00
|
|
|
def setup_dummy_image(maker)
|
|
|
|
title = "fugafuga"
|
|
|
|
link = "http://hoge.com"
|
|
|
|
url = "http://hoge.com/hoge.png"
|
|
|
|
|
|
|
|
maker.channel.link = link if maker.channel.link.nil?
|
2009-03-05 22:56:38 -05:00
|
|
|
|
2004-10-31 09:14:21 -05:00
|
|
|
maker.image.title = title
|
|
|
|
maker.image.url = url
|
|
|
|
end
|
|
|
|
|
|
|
|
def setup_dummy_textinput(maker)
|
|
|
|
title = "fugafuga"
|
|
|
|
description = "text hoge fuga"
|
|
|
|
name = "hoge"
|
|
|
|
link = "http://hoge.com/search.cgi"
|
|
|
|
|
|
|
|
maker.textinput.title = title
|
|
|
|
maker.textinput.description = description
|
|
|
|
maker.textinput.name = name
|
|
|
|
maker.textinput.link = link
|
|
|
|
end
|
|
|
|
|
|
|
|
def setup_dummy_item(maker)
|
|
|
|
title = "TITLE"
|
|
|
|
link = "http://hoge.com/"
|
|
|
|
|
|
|
|
item = maker.items.new_item
|
|
|
|
item.title = title
|
|
|
|
item.link = link
|
|
|
|
end
|
2007-03-17 06:13:25 -04:00
|
|
|
|
|
|
|
def setup_dummy_item_atom(maker)
|
|
|
|
setup_dummy_item(maker)
|
|
|
|
|
|
|
|
item = maker.items.first
|
|
|
|
item.id = "http://example.net/xxx"
|
|
|
|
item.updated = Time.now
|
|
|
|
end
|
|
|
|
|
2005-11-23 04:24:17 -05:00
|
|
|
def setup_taxo_topic(target, topics)
|
|
|
|
topics.each do |topic|
|
|
|
|
taxo_topic = target.taxo_topics.new_taxo_topic
|
|
|
|
topic.each do |name, value|
|
|
|
|
case name
|
|
|
|
when :link
|
|
|
|
taxo_topic.taxo_link = value
|
|
|
|
when :topics
|
|
|
|
value.each do |t|
|
|
|
|
taxo_topic.taxo_topics << t
|
|
|
|
end
|
|
|
|
else
|
|
|
|
dc_elems = taxo_topic.__send__("dc_#{name}s")
|
|
|
|
dc_elem = dc_elems.__send__("new_#{name}")
|
|
|
|
dc_elem.value = value
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
end
|