1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rss/rss.rb (RSS::NotSetError): added.

* lib/rss/maker/{1.0,0.9,2.0}.rb: changed RSS Maker to raise
  RSS::NotSetError if required values of maker.channel are not
  set.
* test/rss/test_maker_{1.0,0.9,2.0}.rb: changed tests to check RSS
  Maker raises or not.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2004-11-28 06:53:41 +00:00
parent 49d454ea2e
commit b684f87574
10 changed files with 256 additions and 194 deletions

View file

@ -85,37 +85,41 @@ module RSS
link = "http://hoge.com"
description = "fugafugafugafuga"
rss = RSS::Maker.make("1.0") do |maker|
# maker.channel.about = about
maker.channel.title = title
maker.channel.link = link
maker.channel.description = description
assert_not_set_error("maker.channel", %w(about)) do
RSS::Maker.make("1.0") do |maker|
# maker.channel.about = about
maker.channel.title = title
maker.channel.link = link
maker.channel.description = description
end
end
assert_nil(rss)
rss = RSS::Maker.make("1.0") do |maker|
maker.channel.about = about
# maker.channel.title = title
maker.channel.link = link
maker.channel.description = description
assert_not_set_error("maker.channel", %w(title)) do
RSS::Maker.make("1.0") do |maker|
maker.channel.about = about
# maker.channel.title = title
maker.channel.link = link
maker.channel.description = description
end
end
assert_nil(rss)
rss = RSS::Maker.make("1.0") do |maker|
maker.channel.about = about
maker.channel.title = title
# maker.channel.link = link
maker.channel.description = description
assert_not_set_error("maker.channel", %w(link)) do
RSS::Maker.make("1.0") do |maker|
maker.channel.about = about
maker.channel.title = title
# maker.channel.link = link
maker.channel.description = description
end
end
assert_nil(rss)
rss = RSS::Maker.make("1.0") do |maker|
maker.channel.about = about
maker.channel.title = title
maker.channel.link = link
# maker.channel.description = description
assert_not_set_error("maker.channel", %w(description)) do
RSS::Maker.make("1.0") do |maker|
maker.channel.about = about
maker.channel.title = title
maker.channel.link = link
# maker.channel.description = description
end
end
assert_nil(rss)
end
@ -138,14 +142,15 @@ module RSS
assert_equal(link, image.link)
assert_equal(url, image.url)
rss = RSS::Maker.make("1.0") do |maker|
# setup_dummy_channel(maker)
maker.channel.link = link
maker.image.title = title
maker.image.url = url
assert_not_set_error("maker.channel", %w(about title description)) do
RSS::Maker.make("1.0") do |maker|
# setup_dummy_channel(maker)
maker.channel.link = link
maker.image.title = title
maker.image.url = url
end
end
assert_nil(rss)
end
def test_not_valid_image
@ -173,15 +178,16 @@ module RSS
assert_nil(rss.channel.image)
assert_nil(rss.image)
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
# maker.channel.link = link
maker.channel.link = nil
maker.image.url = url
maker.image.title = title
assert_not_set_error("maker.channel", %w(link)) do
RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
# maker.channel.link = link
maker.channel.link = nil
maker.image.url = url
maker.image.title = title
end
end
assert_nil(rss)
end
def test_items