3 class OldNodeTagTest < ActiveSupport::TestCase
4 def test_length_key_valid
5 tag = create(:old_node_tag)
8 assert_predicate tag, :valid?
12 def test_length_value_valid
13 tag = create(:old_node_tag)
16 assert_predicate tag, :valid?
20 def test_length_key_invalid
21 tag = create(:old_node_tag)
24 assert_predicate tag.errors[:k], :any?
27 def test_length_value_invalid
28 tag = create(:old_node_tag)
30 assert_not tag.valid?, "Value should be too long"
31 assert_predicate tag.errors[:v], :any?
34 def test_empty_tag_invalid
36 assert_not tag.valid?, "Empty tag should be invalid"
37 assert_predicate tag.errors[:old_node], :any?
41 existing = create(:old_node_tag)
43 tag.node_id = existing.node_id
44 tag.version = existing.version
47 assert_predicate tag, :new_record?
49 assert_raise(ActiveRecord::RecordInvalid) { tag.save! }
50 assert_predicate tag, :new_record?