require File.dirname(__FILE__) + '/../test_helper'
class RelationTagTest < Test::Unit::TestCase
- fixtures :current_relation_tags
- set_fixture_class :current_relation_tags => RelationTag
+ api_fixtures
def test_relation_tag_count
- assert_equal 3, RelationTag.count
+ assert_equal 7, RelationTag.count
end
def test_length_key_valid
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