require File.dirname(__FILE__) + '/../test_helper'

class EntryTest < Test::Unit::TestCase
  fixtures :entries

  def setup
    @entry = Entry.find(:first)
  end

  def test_title_not_wellformed
    @entry.title = "AT&amp;T"
    assert @entry.save, message="save"

    @entry.title = "AT&T"
    assert ! @entry.save, message="save"
    assert_equal "is not well formed XML", @entry.errors.on(:title)
  end

  def test_updated_required
    @entry = Entry.new
    assert ! @entry.save
  end

  def test_updated_valid
    @entry = Entry.new
    @entry.updated = Time.now
    assert @entry.save
  end
end
