1 require File.dirname(__FILE__) + '/../test_helper'
3 class WayTagTest < Test::Unit::TestCase
4 fixtures :current_way_tags
5 set_fixture_class :current_way_tags => WayTag
8 assert_equal 3, WayTag.count
11 def test_length_key_valid
15 tag.id = current_way_tags(:t1).id
17 tag.v = current_way_tags(:t1).v
22 def test_length_value_valid
26 tag.id = current_way_tags(:t1).id
33 def test_length_key_invalid
36 tag.id = current_way_tags(:t1).id
39 assert !tag.valid?, "Key #{i} should be too long"
40 assert tag.errors.invalid?(:k)
44 def test_length_value_invalid
47 tag.id = current_way_tags(:t1).id
50 assert !tag.valid?, "Value #{i} should be too long"
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?