From: Shaun McDonald Date: Mon, 18 Aug 2008 13:55:21 +0000 (+0000) Subject: more testing of node tags X-Git-Tag: live~8121^2~306 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/87494900df0f40c734286139678d347af9c234b7 more testing of node tags --- diff --git a/config/database.yml b/config/database.yml index fe47e11aa..a80e11b70 100644 --- a/config/database.yml +++ b/config/database.yml @@ -12,9 +12,12 @@ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html development: adapter: mysql - database: openstreetmap - username: openstreetmap - password: openstreetmap + #database: openstreetmap + #username: openstreetmap + #password: openstreetmap + database: osm_test + username: osm_test + password: osm_test host: localhost # Warning: The database defined as 'test' will be erased and diff --git a/test/fixtures/current_node_tags.yml b/test/fixtures/current_node_tags.yml index d9f5448a4..ce68a5439 100644 --- a/test/fixtures/current_node_tags.yml +++ b/test/fixtures/current_node_tags.yml @@ -1,15 +1,15 @@ t1: - id: visible_node.id + id: 1 k: testvisible v: yes t2: - id: used_node_1.id + id: 2 k: testused v: yes t3: - id: used_node_2.id + id: 3 k: test v: yes diff --git a/test/unit/current_node_tag_test.rb b/test/unit/current_node_tag_test.rb index 69b123b5a..7fb1deff5 100644 --- a/test/unit/current_node_tag_test.rb +++ b/test/unit/current_node_tag_test.rb @@ -1,10 +1,20 @@ require File.dirname(__FILE__) + '/../test_helper' class CurrentNodeTagTest < Test::Unit::TestCase - fixtures :current_node_tags, :nodes + fixtures :current_node_tags, :current_nodes + set_fixture_class :current_nodes => :Node + set_fixture_class :current_node_tags => :NodeTag def test_tag_count assert_equal 3, NodeTag.count + node_tag_count(:visible_node, 1) + node_tag_count(:invisible_node, 1) + node_tag_count(:used_node_1, 1) + end + + def node_tag_count (node, count) + nod = current_nodes(node) + assert_equal count, nod.node_tags.count end end diff --git a/test/unit/node_test.rb b/test/unit/node_test.rb index b5ef30298..bb2b7dfa4 100644 --- a/test/unit/node_test.rb +++ b/test/unit/node_test.rb @@ -5,7 +5,7 @@ class NodeTest < Test::Unit::TestCase set_fixture_class :current_nodes => :Node set_fixture_class :nodes => :OldNode set_fixture_class :node_tags => :OldNodeTag - set_fixture_class :currenr_node_tags => :NodeTag + set_fixture_class :current_node_tags => :NodeTag def test_node_too_far_north invalid_node_test(:node_too_far_north)