1 require File.dirname(__FILE__) + '/../test_helper'
3 class WayTest < Test::Unit::TestCase
6 # Check that we have the correct number of currnet ways in the db
7 # This will need to updated whenever the current_ways.yml is updated
9 assert_equal 4, Way.count
13 node = current_nodes(:used_node_1)
16 :used_way ].each do |way_symbol|
17 way = current_ways(way_symbol)
18 assert_equal node.bbox, way.bbox
22 # Check that the preconditions fail when you are over the defined limit of
23 # the maximum number of nodes in each way.
24 def test_max_nodes_per_way_limit
25 # Take one of the current ways and add nodes to it until we are near the limit
26 way = Way.find(current_ways(:visible_way).id)
28 # it already has 1 node
29 1.upto((APP_CONFIG['max_number_of_way_nodes'])/2) {
30 way.add_nd_num(current_nodes(:used_node_1).id)
31 way.add_nd_num(current_nodes(:used_node_2).id)
36 way.add_nd_num(current_nodes(:visible_node).id)