#!/usr/bin/ruby require "test/unit" require "atom/yaml" require "atom/xml" require "atom/feed" class AtomTest < Test::Unit::TestCase def test_feed_duplicate_id feed = Atom::Feed.new entry1 = get_entry entry1.id = "http://example.org/test" entry1.content = "an original entry" entry1.updated! feed << entry1 assert_equal(1, feed.entries.length) assert_equal("an original entry", feed.entries.first.content.to_s) feed << entry1.dup assert_equal(1, feed.entries.length) assert_equal("an original entry", feed.entries.first.content.to_s) entry2 = entry1.dup entry2.content = "a changed entry" entry2.updated! feed << entry2 assert_equal(1, feed.entries.length) assert_equal("a changed entry", feed.entries.last.content.to_s) end def test_tags entry = get_entry entry.tag_with "test tags" xml = get_elements entry assert_has_category(xml, "test") assert_has_category(xml, "tags") end def test_devour_yaml time = Time.parse "2007-01-18T12:37:46Z" yaml = <