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 | aece192714a532bbace8bb12e958b012f8bb6161 (patch) | |
| tree | 815db606a379a4c1e3055ad7f873ef2403d446e4 /test/rss | |
| parent | 5956031818601953ad7cba73b57599eafc89cd78 (diff) | |
| download | ruby-aece192714a532bbace8bb12e958b012f8bb6161.tar.gz ruby-aece192714a532bbace8bb12e958b012f8bb6161.tar.xz ruby-aece192714a532bbace8bb12e958b012f8bb6161.zip | |
* 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: http://svn.ruby-lang.org/repos/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 40a72e93c..6b83cbe09 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 098263a39..27b4eba5d 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 43a168d03..e6a81af2b 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 1b92f9d98..5281a81c2 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 c0f6e4292..77cd1c700 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 796666cdb..d95d31f24 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 3fd26bffb..de4894997 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 9d620089e..a3dd763c8 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 9c4b086ca..bfe39d005 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 f3dee2c63..ab16d6e2f 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" |
