1 require File.dirname(__FILE__) + '/../test_helper'
3 class WayTagTest < ActiveSupport::TestCase
7 assert_equal 3, WayTag.count
10 def test_length_key_valid
14 tag.id = current_way_tags(:t1).id
16 tag.v = current_way_tags(:t1).v
21 def test_length_value_valid
25 tag.id = current_way_tags(:t1).id
32 def test_length_key_invalid
35 tag.id = current_way_tags(:t1).id
38 assert !tag.valid?, "Key #{i} should be too long"
39 assert tag.errors.invalid?(:k)
43 def test_length_value_invalid
46 tag.id = current_way_tags(:t1).id
49 assert !tag.valid?, "Value #{i} should be too long"
50 assert tag.errors.invalid?(:v)
54 def test_empty_tag_invalid
56 assert !tag.valid?, "Empty way tag should be invalid"
57 assert tag.errors.invalid?(:id)
62 tag.id = current_way_tags(:t1).id
63 tag.k = current_way_tags(:t1).k
64 tag.v = current_way_tags(:t1).v
65 assert tag.new_record?
67 assert_raise(ActiveRecord::RecordInvalid) {tag.save!}
68 assert tag.new_record?