Tests for [17838]
Why is our testing fixtures such a mess? It took me half an hour to find a useable node. And I'm still not sure if it's ok, since I want to get to bed. kthxbye
This commit is contained in:
parent
ec26e06706
commit
76b6d7d876
7 changed files with 40 additions and 6 deletions
10
test/fixtures/current_way_nodes.yml
vendored
10
test/fixtures/current_way_nodes.yml
vendored
|
@ -17,3 +17,13 @@ t4:
|
|||
id: 4
|
||||
node_id: 15
|
||||
sequence_id: 1
|
||||
|
||||
w5_n1:
|
||||
id: 5
|
||||
node_id: 4
|
||||
sequence_id: 1
|
||||
|
||||
w5_n2:
|
||||
id: 5
|
||||
node_id: 4
|
||||
sequence_id: 2
|
||||
|
|
7
test/fixtures/current_ways.yml
vendored
7
test/fixtures/current_ways.yml
vendored
|
@ -25,3 +25,10 @@ way_with_versions:
|
|||
timestamp: 2008-01-01 00:04:00
|
||||
visible: true
|
||||
version: 4
|
||||
|
||||
way_with_duplicate_nodes:
|
||||
id: 5
|
||||
changeset_id: 2
|
||||
timestamp: 2007-01-01 00:00:00
|
||||
visible: true
|
||||
version: 1
|
||||
|
|
12
test/fixtures/way_nodes.yml
vendored
12
test/fixtures/way_nodes.yml
vendored
|
@ -63,3 +63,15 @@ w4_v4_n1:
|
|||
node_id: 15
|
||||
sequence_id: 1
|
||||
version: 4
|
||||
|
||||
w5_n1:
|
||||
id: 5
|
||||
node_id: 4
|
||||
sequence_id: 1
|
||||
version: 1
|
||||
|
||||
w5_n2:
|
||||
id: 5
|
||||
node_id: 4
|
||||
sequence_id: 2
|
||||
version: 1
|
||||
|
|
6
test/fixtures/ways.yml
vendored
6
test/fixtures/ways.yml
vendored
|
@ -47,3 +47,9 @@ way_with_versions_v4:
|
|||
visible: true
|
||||
version: 4
|
||||
|
||||
way_with_duplicate_nodes:
|
||||
id: 5
|
||||
changeset_id: 2
|
||||
timestamp: 2007-01-01 00:00:00
|
||||
visible: true
|
||||
version: 1
|
||||
|
|
|
@ -41,11 +41,10 @@ class WayControllerTest < ActionController::TestCase
|
|||
assert_select "osm way[id=#{way.id}][version=#{way.version}][visible=#{way.visible}]", 1
|
||||
|
||||
# check that each node in the way appears once in the output as a
|
||||
# reference and as the node element. note the slightly dodgy assumption
|
||||
# that nodes appear only once. this is currently the case with the
|
||||
# fixtures, but it doesn't have to be.
|
||||
# reference and as the node element.
|
||||
way.nodes.each do |n|
|
||||
assert_select "osm way nd[ref=#{n.id}]", 1
|
||||
count = (way.nodes - (way.nodes - [n])).length
|
||||
assert_select "osm way nd[ref=#{n.id}]", count
|
||||
assert_select "osm node[id=#{n.id}][version=#{n.version}][lat=#{n.lat}][lon=#{n.lon}]", 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ class WayNodeTest < ActiveSupport::TestCase
|
|||
api_fixtures
|
||||
|
||||
def test_way_nodes_count
|
||||
assert_equal 4, WayNode.count
|
||||
assert_equal 6, WayNode.count
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class WayTest < ActiveSupport::TestCase
|
|||
# Check that we have the correct number of currnet ways in the db
|
||||
# This will need to updated whenever the current_ways.yml is updated
|
||||
def test_db_count
|
||||
assert_equal 4, Way.count
|
||||
assert_equal 5, Way.count
|
||||
end
|
||||
|
||||
def test_bbox
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue