1 require File.dirname(__FILE__) + '/../test_helper'
3 class WayTagTest < ActiveSupport::TestCase
7 assert_equal 3, OldWayTag.count
10 def test_length_key_valid
14 tag.way_id = way_tags(:t1).way_id
22 def test_length_value_valid
26 tag.way_id = way_tags(:t1).way_id
34 def test_length_key_invalid
37 tag.way_id = way_tags(:t1).way_id
41 assert !tag.valid?, "Key should be too long"
42 assert tag.errors[:k].any?
46 def test_length_value_invalid
49 tag.way_id = way_tags(:t1).way_id
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_way].any?
66 tag.way_id = way_tags(:t1).way_id
67 tag.version = way_tags(:t1).version
68 tag.k = way_tags(:t1).k
69 tag.v = way_tags(:t1).v
70 assert tag.new_record?
72 assert_raise(ActiveRecord::RecordInvalid) {tag.save!}
73 assert tag.new_record?