From: Matt Amos Date: Tue, 21 Oct 2008 11:40:06 +0000 (+0000) Subject: Refactored test a bit to make it nicer. X-Git-Tag: live~7573^2~249 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/5dd3eb769a71784f52c977fec73a28b10cbcb7f5 Refactored test a bit to make it nicer. --- diff --git a/test/functional/relation_controller_test.rb b/test/functional/relation_controller_test.rb index 939a73df1..1c6439a96 100644 --- a/test/functional/relation_controller_test.rb +++ b/test/functional/relation_controller_test.rb @@ -49,15 +49,17 @@ class RelationControllerTest < Test::Unit::TestCase get :relations_for_node, :id => node_id assert_response :success + # the results we expect + expected_relations = [ :visible_relation, :used_relation ] + # count one osm element assert_select "osm[version=#{API_VERSION}][generator=\"OpenStreetMap server\"]", 1 - # we should have only two relations - assert_select "osm>relation", 2 + # we should have only the expected number of relations + assert_select "osm>relation", expected_relations.size # and each of them should contain the node we originally searched for - [ :visible_relation, - :used_relation ].each do |r| + expected_relations.each do |r| relation_id = current_relations(r).id assert_select "osm>relation#?", relation_id assert_select "osm>relation#?>member[type=\"node\"][ref=#{node_id}]", relation_id