diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-16 09:03:04 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-16 09:03:04 +0000 |
commit | da3ec26894eab0706a77b19d2539245101d36cfa (patch) | |
tree | b71f7c3dc8b615fbabe8ba12ded9d4be10d0cd52 | |
parent | 805d87a01644931aed9c5eaf870e5f6a5085cc83 (diff) | |
download | ruby-da3ec26894eab0706a77b19d2539245101d36cfa.tar.gz ruby-da3ec26894eab0706a77b19d2539245101d36cfa.tar.xz ruby-da3ec26894eab0706a77b19d2539245101d36cfa.zip |
* lib/rss/maker/feed.rb, test/test_maker_atom_entry.rb,
test/test_maker_atom_feed.rb: fix duplicated dc:date.
Reported by Kazuhiro NISHIYAMA. Thanks!!! [ruby-list:46014]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/rss/maker/feed.rb | 1 | ||||
-rw-r--r-- | test/rss/test_maker_atom_entry.rb | 15 | ||||
-rw-r--r-- | test/rss/test_maker_atom_feed.rb | 14 |
4 files changed, 36 insertions, 0 deletions
@@ -1,3 +1,9 @@ +Sat May 16 18:02:57 2009 Kouhei Sutou <kou@cozmixng.org> + + * lib/rss/maker/feed.rb, test/test_maker_atom_entry.rb, + test/test_maker_atom_feed.rb: fix duplicated dc:date. + Reported by Kazuhiro NISHIYAMA. Thanks!!! [ruby-list:46014] + Sat May 16 18:02:16 2009 Kouhei Sutou <kou@cozmixng.org> * lib/rss/maker/base.rb, lib/rss/maker/1.0.rb, lib/rss/maker/feed.rb, diff --git a/lib/rss/maker/feed.rb b/lib/rss/maker/feed.rb index fa3a17716..90e2c1407 100644 --- a/lib/rss/maker/feed.rb +++ b/lib/rss/maker/feed.rb @@ -184,6 +184,7 @@ module RSS set_default_values do entry = feed.class::Entry.new set = setup_values(entry) + entry.dc_dates.clear setup_other_elements(feed, entry) if set feed.entries << entry diff --git a/test/rss/test_maker_atom_entry.rb b/test/rss/test_maker_atom_entry.rb index 09f16f542..c9b9f8953 100644 --- a/test/rss/test_maker_atom_entry.rb +++ b/test/rss/test_maker_atom_entry.rb @@ -368,5 +368,20 @@ module RSS setup_dummy_item_atom(maker) end end + + def test_date + date = Time.parse("2004/11/1 10:10") + feed = Maker.make("atom:entry") do |maker| + setup_dummy_channel_atom(maker) + maker.channel.date = nil + maker.items.new_item do |item| + item.link = "http://example.com/article.html" + item.title = "Sample Article" + item.date = date + end + end + assert_equal(date, feed.items[0].updated.content) + assert_equal([date], feed.items[0].dc_dates.collect {|date| date.value}) + end end end diff --git a/test/rss/test_maker_atom_feed.rb b/test/rss/test_maker_atom_feed.rb index 8b32189b9..7a2bb63b0 100644 --- a/test/rss/test_maker_atom_feed.rb +++ b/test/rss/test_maker_atom_feed.rb @@ -401,5 +401,19 @@ module RSS end assert_equal(language, feed.dc_language) end + + def test_date + date = Time.parse("2004/11/1 10:10") + feed = Maker.make("atom") do |maker| + setup_dummy_channel_atom(maker) + maker.items.new_item do |item| + item.link = "http://example.com/article.html" + item.title = "Sample Article" + item.date = date + end + end + assert_equal(date, feed.items[0].updated.content) + assert_equal([date], feed.items[0].dc_dates.collect {|date| date.value}) + end end end |