Refactored test a bit to make it nicer.
This commit is contained in:
parent
498d695064
commit
5dd3eb769a
1 changed files with 6 additions and 4 deletions
|
@ -49,15 +49,17 @@ class RelationControllerTest < Test::Unit::TestCase
|
||||||
get :relations_for_node, :id => node_id
|
get :relations_for_node, :id => node_id
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
|
# the results we expect
|
||||||
|
expected_relations = [ :visible_relation, :used_relation ]
|
||||||
|
|
||||||
# count one osm element
|
# count one osm element
|
||||||
assert_select "osm[version=#{API_VERSION}][generator=\"OpenStreetMap server\"]", 1
|
assert_select "osm[version=#{API_VERSION}][generator=\"OpenStreetMap server\"]", 1
|
||||||
|
|
||||||
# we should have only two relations
|
# we should have only the expected number of relations
|
||||||
assert_select "osm>relation", 2
|
assert_select "osm>relation", expected_relations.size
|
||||||
|
|
||||||
# and each of them should contain the node we originally searched for
|
# and each of them should contain the node we originally searched for
|
||||||
[ :visible_relation,
|
expected_relations.each do |r|
|
||||||
:used_relation ].each do |r|
|
|
||||||
relation_id = current_relations(r).id
|
relation_id = current_relations(r).id
|
||||||
assert_select "osm>relation#?", relation_id
|
assert_select "osm>relation#?", relation_id
|
||||||
assert_select "osm>relation#?>member[type=\"node\"][ref=#{node_id}]", relation_id
|
assert_select "osm>relation#?>member[type=\"node\"][ref=#{node_id}]", relation_id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue