1 require File.dirname(__FILE__) + '/../test_helper'
3 class OldNodeTest < ActiveSupport::TestCase
6 def test_old_node_tag_count
7 assert_equal 9, OldNodeTag.count, "Unexpected number of fixtures loaded."
10 def test_length_key_valid
14 tag.id = node_tags(:t1).id
15 tag.version = node_tags(:t1).version
22 def test_length_value_valid
26 tag.id = node_tags(:t1).id
27 tag.version = node_tags(:t1).version
34 def test_length_key_invalid
37 tag.id = node_tags(:t1).id
38 tag.version = node_tags(:t1).version
40 tag.v = "v", "Key should be too long"
42 assert tag.errors.invalid?(:k)
46 def test_length_value_invalid
49 tag.id = node_tags(:t1).id
50 tag.version = node_tags(:t1).version
53 assert !tag.valid?, "Value should be too long"
54 assert tag.errors.invalid?(:v)
58 def test_empty_old_node_tag_invalid
60 assert !tag.valid?, "Empty tag should be invalid"
61 assert tag.errors.invalid?(:id)
62 assert tag.errors.invalid?(:version)
67 tag.id = node_tags(:t1).id
68 tag.version = node_tags(:t1).version
69 tag.k = node_tags(:t1).k
70 tag.v = node_tags(:t1).v
71 assert tag.new_record?
73 assert_raise(ActiveRecord::RecordInvalid) {tag.save!}
74 assert tag.new_record?