1 require File.dirname(__FILE__) + '/../test_helper'
3 class TracetagTest < ActiveSupport::TestCase
6 def test_tracetag_count
7 assert_equal 4, Tracetag.count
12 tracetag_valid({:tag => nil}, false)
13 tracetag_valid({:tag => ''}, false)
14 tracetag_valid({:tag => 'a'})
15 tracetag_valid({:tag => 'a'*255})
16 tracetag_valid({:tag => 'a'*256}, false)
17 tracetag_valid({:tag => 'a/b'}, false)
18 tracetag_valid({:tag => 'a;b'}, false)
19 tracetag_valid({:tag => 'a.b'}, false)
20 tracetag_valid({:tag => 'a,b'}, false)
21 tracetag_valid({:tag => 'a?b'}, false)
26 def tracetag_valid(attrs, result = true)
27 entry = Tracetag.new(gpx_file_tags(:first_trace_1).attributes)
28 entry.assign_attributes(attrs)
29 assert_equal result, entry.valid?, "Expected #{attrs.inspect} to be #{result}"