3 class OldNodeTagTest < ActiveSupport::TestCase
6 def test_old_node_tag_count
7 assert_equal 19, OldNodeTag.count, "Unexpected number of fixtures loaded."
10 def test_length_key_valid
14 tag.node_id = node_tags(:t1).node_id
15 tag.version = node_tags(:t1).version
22 def test_length_value_valid
26 tag.node_id = node_tags(:t1).node_id
27 tag.version = node_tags(:t1).version
34 def test_length_key_invalid
37 tag.node_id = node_tags(:t1).node_id
38 tag.version = node_tags(:t1).version
40 tag.v = "v", "Key should be too long"
42 assert tag.errors[:k].any?
46 def test_length_value_invalid
49 tag.node_id = node_tags(:t1).node_id
50 tag.version = node_tags(:t1).version
53 assert !tag.valid?, "Value should be too long"
54 assert tag.errors[:v].any?
58 def test_empty_tag_invalid
60 assert !tag.valid?, "Empty tag should be invalid"
61 assert tag.errors[:old_node].any?
66 tag.node_id = node_tags(:t1).node_id
67 tag.version = node_tags(:t1).version
68 tag.k = node_tags(:t1).k
69 tag.v = node_tags(:t1).v
70 assert tag.new_record?
72 assert_raise(ActiveRecord::RecordInvalid) {tag.save!}
73 assert tag.new_record?