3 class WayTagTest < ActiveSupport::TestCase
6 def test_length_key_valid
14 def test_length_value_valid
15 tag = create(:way_tag)
22 def test_length_key_invalid
23 tag = create(:way_tag)
25 assert !tag.valid?, "Key should be too long"
26 assert tag.errors[:k].any?
29 def test_length_value_invalid
30 tag = create(:way_tag)
32 assert !tag.valid?, "Value should be too long"
33 assert tag.errors[:v].any?
36 def test_empty_tag_invalid
38 assert !tag.valid?, "Empty way tag should be invalid"
39 assert tag.errors[:way].any?
43 existing = create(:way_tag)
45 tag.way_id = existing.way_id
48 assert tag.new_record?
50 assert_raise(ActiveRecord::RecordInvalid) { tag.save! }
51 assert tag.new_record?