From: Matt Amos Date: Tue, 21 Apr 2009 19:53:14 +0000 (+0000) Subject: Extra test for updating relation tags. X-Git-Tag: live~7548 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/d5d9b1a3743568c8c429b9a9a713a799776012ca?hp=6488ebe12fa01f7622eae8a44e52fcb0dfaeb264;ds=sidebyside Extra test for updating relation tags. --- diff --git a/test/unit/relation_tag_test.rb b/test/unit/relation_tag_test.rb index 43f0b5a4f..54ee57e1e 100644 --- a/test/unit/relation_tag_test.rb +++ b/test/unit/relation_tag_test.rb @@ -67,4 +67,20 @@ class RelationTagTest < Test::Unit::TestCase assert_raise(ActiveRecord::RecordInvalid) {tag.save!} assert tag.new_record? end + + ## + # test that tags can be updated and saved uniquely, i.e: tag.save! + # only affects the single tag that the activerecord object + # represents. this amounts to testing that the primary key is + # unique. + def test_update + v = "probably unique string here 3142592654" + assert_equal 0, RelationTag.count(:conditions => ['v=?', v]) + + tag = RelationTag.find(:first) + tag.v = v + tag.save! + + assert_equal 1, RelationTag.count(:conditions => ['v=?', v]) + end end