1 require File.dirname(__FILE__) + '/../test_helper'
3 class RelationTagTest < Test::Unit::TestCase
6 def test_relation_tag_count
7 assert_equal 3, RelationTag.count
10 def test_length_key_valid
21 def test_length_value_valid
32 def test_length_key_invalid
38 assert !tag.valid?, "Key #{i} should be too long"
39 assert tag.errors.invalid?(:k)
43 def test_length_value_invalid
49 assert !tag.valid?, "Value #{i} should be too long"
50 assert tag.errors.invalid?(:v)
54 def test_empty_tag_invalid
56 assert !tag.valid?, "Empty relation tag should be invalid"
57 assert tag.errors.invalid?(:id)
62 tag.id = current_relation_tags(:t1).id
63 tag.k = current_relation_tags(:t1).k
64 tag.v = current_relation_tags(:t1).v
65 assert tag.new_record?
67 assert_raise(ActiveRecord::RecordInvalid) {tag.save!}
68 assert tag.new_record?