diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-03 07:03:33 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-03 07:03:33 +0000 |
commit | b45e1493f866746bd989a1939180ebe9c6bd3ae2 (patch) | |
tree | 815db606a379a4c1e3055ad7f873ef2403d446e4 /test/rss | |
parent | 3d712cdd9d1f99c6bcc106898783bafe9d2c1cde (diff) | |
download | ruby-b45e1493f866746bd989a1939180ebe9c6bd3ae2.tar.gz |
* test/rss/test_maker_*.rb: added tests for RSS Maker.
* lib/rss/maker.rb: added RSS Maker.
* lib/rss/maker/*.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rss')
-rw-r--r-- | test/rss/rss-assertions.rb | 25 | ||||
-rw-r--r-- | test/rss/rss-testcase.rb | 47 | ||||
-rw-r--r-- | test/rss/test_1.0.rb | 2 | ||||
-rw-r--r-- | test/rss/test_accessor.rb | 2 | ||||
-rw-r--r-- | test/rss/test_content.rb | 2 | ||||
-rw-r--r-- | test/rss/test_dublincore.rb | 2 | ||||
-rw-r--r-- | test/rss/test_parser.rb | 2 | ||||
-rw-r--r-- | test/rss/test_syndication.rb | 2 | ||||
-rw-r--r-- | test/rss/test_trackback.rb | 2 | ||||
-rw-r--r-- | test/rss/test_xml-stylesheet.rb | 2 |
10 files changed, 71 insertions, 17 deletions
diff --git a/test/rss/rss-assertions.rb b/test/rss/rss-assertions.rb index 40a72e93cd..6b83cbe093 100644 --- a/test/rss/rss-assertions.rb +++ b/test/rss/rss-assertions.rb @@ -1,4 +1,3 @@ -# -*- tab-width: 2 -*- vim: ts=2 module Test module Unit module Assertions @@ -134,6 +133,30 @@ module RSS pi_str = rdf.to_s.gsub(/<\?xml .*\n/, "").gsub(/\s*<rdf:RDF.*\z/m, "") assert_equal(xss_strs.join("\n"), pi_str) end + + def assert_dublin_core(elems, target) + elems.each do |name, value| + assert_equal(value, target.__send__("dc_#{name}")) + end + end + + def assert_syndication(elems, target) + elems.each do |name, value| + assert_equal(value, target.__send__("sy_#{name}")) + end + end + + def assert_content(elems, target) + elems.each do |name, value| + assert_equal(value, target.__send__("content_#{name}")) + end + end + + def assert_trackback(elems, target) + elems.each do |name, value| + assert_equal(value, target.__send__("trackback_#{name}")) + end + end end end diff --git a/test/rss/rss-testcase.rb b/test/rss/rss-testcase.rb index 098263a392..27b4eba5d6 100644 --- a/test/rss/rss-testcase.rb +++ b/test/rss/rss-testcase.rb @@ -189,5 +189,52 @@ EOI EOC end + private + def setup_dummy_channel(maker) + about = "http://hoge.com" + title = "fugafuga" + link = "http://hoge.com" + 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 + + 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? + + 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 + end end diff --git a/test/rss/test_1.0.rb b/test/rss/test_1.0.rb index 43a168d035..e6a81af2bd 100644 --- a/test/rss/test_1.0.rb +++ b/test/rss/test_1.0.rb @@ -1,5 +1,3 @@ -# -*- tab-width: 2 -*- vim: ts=2 - require "rexml/document" require "rss-testcase" diff --git a/test/rss/test_accessor.rb b/test/rss/test_accessor.rb index 1b92f9d98c..5281a81c2c 100644 --- a/test/rss/test_accessor.rb +++ b/test/rss/test_accessor.rb @@ -1,5 +1,3 @@ -# -*- tab-width: 2 -*- vim: ts=2 - require "rss-testcase" require "rss/1.0" diff --git a/test/rss/test_content.rb b/test/rss/test_content.rb index c0f6e4292f..77cd1c7005 100644 --- a/test/rss/test_content.rb +++ b/test/rss/test_content.rb @@ -1,5 +1,3 @@ -# -*- tab-width: 2 -*- vim: ts=2 - require "cgi" require "rexml/document" diff --git a/test/rss/test_dublincore.rb b/test/rss/test_dublincore.rb index 796666cdb5..d95d31f24e 100644 --- a/test/rss/test_dublincore.rb +++ b/test/rss/test_dublincore.rb @@ -1,5 +1,3 @@ -# -*- tab-width: 2 -*- vim: ts=2 - require "cgi" require "rexml/document" diff --git a/test/rss/test_parser.rb b/test/rss/test_parser.rb index 3fd26bffb4..de4894997f 100644 --- a/test/rss/test_parser.rb +++ b/test/rss/test_parser.rb @@ -1,5 +1,3 @@ -# -*- tab-width: 2 -*- vim: ts=2 - require "rss-testcase" require "rss/1.0" diff --git a/test/rss/test_syndication.rb b/test/rss/test_syndication.rb index 9d620089e1..a3dd763c83 100644 --- a/test/rss/test_syndication.rb +++ b/test/rss/test_syndication.rb @@ -1,5 +1,3 @@ -# -*- tab-width: 2 -*- vim: ts=2 - require "cgi" require "rexml/document" diff --git a/test/rss/test_trackback.rb b/test/rss/test_trackback.rb index 9c4b086cae..bfe39d005b 100644 --- a/test/rss/test_trackback.rb +++ b/test/rss/test_trackback.rb @@ -1,5 +1,3 @@ -# -*- tab-width: 2 -*- vim: ts=2 - require "cgi" require "rexml/document" diff --git a/test/rss/test_xml-stylesheet.rb b/test/rss/test_xml-stylesheet.rb index f3dee2c63b..ab16d6e2ff 100644 --- a/test/rss/test_xml-stylesheet.rb +++ b/test/rss/test_xml-stylesheet.rb @@ -1,5 +1,3 @@ -# -*- tab-width: 2 -*- vim: ts=2 - require "rexml/document" require "rss-testcase" |