1 require File.dirname(__FILE__) + '/../test_helper'
3 class RelationTagTest < Test::Unit::TestCase
4 fixtures :current_relation_tags
5 set_fixture_class :current_relation_tags => RelationTag
7 def test_relation_tag_count
8 assert_equal 3, RelationTag.count
11 def test_length_key_valid
22 def test_length_value_valid
33 def test_length_key_invalid
39 assert !tag.valid?, "Key #{i} should be too long"
40 assert tag.errors.invalid?(:k)
44 def test_length_value_invalid
50 assert !tag.valid?, "Value #{i} should be too long"
51 assert tag.errors.invalid?(:v)
55 def test_empty_tag_invalid
57 assert !tag.valid?, "Empty relation tag should be invalid"
58 assert tag.errors.invalid?(:id)
63 tag.id = current_relation_tags(:t1).id
64 tag.k = current_relation_tags(:t1).k
65 tag.v = current_relation_tags(:t1).v
66 assert tag.new_record?
68 assert_raise(ActiveRecord::RecordInvalid) {tag.save!}
69 assert tag.new_record?