summaryrefslogtreecommitdiff
path: root/test/rss/rss-testcase.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rss/rss-testcase.rb')
-rw-r--r--test/rss/rss-testcase.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/rss/rss-testcase.rb b/test/rss/rss-testcase.rb
index 0fd9b52..79f8cb8 100644
--- a/test/rss/rss-testcase.rb
+++ b/test/rss/rss-testcase.rb
@@ -326,11 +326,18 @@ EOA
attrs_str = attrs.collect do |name, value|
"#{h name}='#{h value}'"
end.join(" ")
- contents_str = contents.collect do |name, value|
- "#{Element::INDENT}<#{h name}>#{h value}</#{h name}>"
- end.join("\n")
+ 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}>\n#{contents_str}\n</#{h elem_name}>"
+ "<#{h elem_name}#{attrs_str}>#{contents_str}</#{h elem_name}>"
end
def xmlns_container(xmlns_decls, content)