3 class WayTagTest < ActiveSupport::TestCase
4 def test_length_key_valid
12 def test_length_value_valid
13 tag = create(:way_tag)
20 def test_length_key_invalid
21 tag = create(:way_tag)
23 assert !tag.valid?, "Key should be too long"
24 assert tag.errors[:k].any?
27 def test_length_value_invalid
28 tag = create(:way_tag)
30 assert !tag.valid?, "Value should be too long"
31 assert tag.errors[:v].any?
34 def test_empty_tag_invalid
36 assert !tag.valid?, "Empty way tag should be invalid"
37 assert tag.errors[:way].any?
41 existing = create(:way_tag)
43 tag.way_id = existing.way_id
46 assert tag.new_record?
48 assert_raise(ActiveRecord::RecordInvalid) { tag.save! }
49 assert tag.new_record?