enable passing .osm file to cuke tests

This commit is contained in:
Emil Tin 2013-08-30 12:56:52 +02:00
parent 463a297f0c
commit d17150270e

View File

@ -52,6 +52,7 @@ Given /^the nodes$/ do |table|
end end
Given /^the ways$/ do |table| Given /^the ways$/ do |table|
raise "*** Map data already defined - did you pass an input file in this scenaria?" if @osm_str
table.hashes.each do |row| table.hashes.each do |row|
way = OSM::Way.new make_osm_id, OSM_USER, OSM_TIMESTAMP way = OSM::Way.new make_osm_id, OSM_USER, OSM_TIMESTAMP
way.uid = OSM_UID way.uid = OSM_UID
@ -89,6 +90,7 @@ Given /^the ways$/ do |table|
end end
Given /^the relations$/ do |table| Given /^the relations$/ do |table|
raise "*** Map data already defined - did you pass an input file in this scenaria?" if @osm_str
table.hashes.each do |row| table.hashes.each do |row|
relation = OSM::Relation.new make_osm_id, OSM_USER, OSM_TIMESTAMP relation = OSM::Relation.new make_osm_id, OSM_USER, OSM_TIMESTAMP
row.each_pair do |key,value| row.each_pair do |key,value|
@ -119,3 +121,7 @@ end
Given /^the defaults$/ do Given /^the defaults$/ do
end end
Given /^the input file ([^"]*)$/ do |file|
raise "*** Input file must in .osm format" unless File.extname(file)=='.osm'
@osm_str = File.read file
end