- def test_changeset_tags_count
- assert_equal 1, ChangesetTag.count
+ def test_length_value_valid
+ val = "v"
+ (0..255).each do |i|
+ tag = ChangesetTag.new
+ tag.id = 1
+ tag.k = "k"
+ tag.v = val*i
+ assert_valid tag
+ end
+ end
+
+ def test_length_key_invalid
+ ["k"*256].each do |k|
+ tag = ChangesetTag.new
+ tag.id = 1
+ tag.k = k
+ tag.v = "v"
+ assert !tag.valid?, "Key #{k} should be too long"
+ assert tag.errors.invalid?(:k)
+ end
+ end
+
+ def test_length_value_invalid
+ ["v"*256].each do |v|
+ tag = ChangesetTag.new
+ tag.id = 1
+ tag.k = "k"
+ tag.v = v
+ assert !tag.valid?, "Value #{v} should be too long"
+ assert tag.errors.invalid?(:v)
+ end