summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-16 23:40:34 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-16 23:40:34 +0000
commitdcaeabb076431af137e371c5d8b98d149b8b02bf (patch)
treed01f73b65de63703a5295d7f5d0c940daea1e237 /test
parentab28565b7eede19739757c2c91f5213fde3e7a56 (diff)
* lib/rss/maker/base.rb (RSS::Maker::ItemsBase#normalize): fixed
strange RSS::Maker::Item#max_size behavior. Thanks to Kazuhiko <kazuhiko@fdiary.net>. * test/rss/test_maker_1.0.rb (RSS::TestMaker10#test_items): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/rss/test_maker_1.0.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/rss/test_maker_1.0.rb b/test/rss/test_maker_1.0.rb
index 1fa8666..dca50f7 100644
--- a/test/rss/test_maker_1.0.rb
+++ b/test/rss/test_maker_1.0.rb
@@ -256,6 +256,60 @@ module RSS
assert_equal("#{link}#{i}", item.link)
assert_equal("#{description}#{i}", item.description)
end
+
+ max_size = item_size / 2
+ rss = RSS::Maker.make("1.0") do |maker|
+ setup_dummy_channel(maker)
+
+ item_size.times do |i|
+ item = maker.items.new_item
+ item.title = "#{title}#{i}"
+ item.link = "#{link}#{i}"
+ item.description = "#{description}#{i}"
+ end
+ maker.items.max_size = max_size
+ end
+ assert_equal(max_size, rss.items.size)
+ rss.items.each_with_index do |item, i|
+ assert_equal("#{link}#{i}", item.about)
+ assert_equal("#{title}#{i}", item.title)
+ assert_equal("#{link}#{i}", item.link)
+ assert_equal("#{description}#{i}", item.description)
+ end
+
+ max_size = 0
+ rss = RSS::Maker.make("1.0") do |maker|
+ setup_dummy_channel(maker)
+
+ item_size.times do |i|
+ item = maker.items.new_item
+ item.title = "#{title}#{i}"
+ item.link = "#{link}#{i}"
+ item.description = "#{description}#{i}"
+ end
+ maker.items.max_size = max_size
+ end
+ assert_equal(max_size, rss.items.size)
+
+ max_size = -2
+ rss = RSS::Maker.make("1.0") do |maker|
+ setup_dummy_channel(maker)
+
+ item_size.times do |i|
+ item = maker.items.new_item
+ item.title = "#{title}#{i}"
+ item.link = "#{link}#{i}"
+ item.description = "#{description}#{i}"
+ end
+ maker.items.max_size = max_size
+ end
+ assert_equal(item_size + max_size + 1, rss.items.size)
+ rss.items.each_with_index do |item, i|
+ assert_equal("#{link}#{i}", item.about)
+ assert_equal("#{title}#{i}", item.title)
+ assert_equal("#{link}#{i}", item.link)
+ assert_equal("#{description}#{i}", item.description)
+ end
end
def test_not_valid_items