cuke testing of timestamp api

This commit is contained in:
Emil Tin
2012-12-10 16:07:47 +01:00
parent a255f222ef
commit b10b716733
10 changed files with 69 additions and 25 deletions
+1
View File
@@ -61,6 +61,7 @@ Given /^the preprocessed files for "([^"]*)" are present and up to date$/ do |ar
File.exists?("#{area}.osrm.edges").should == true
File.exists?("#{area}.osrm.ramIndex").should == true
File.exists?("#{area}.osrm.fileIndex").should == true
File.exists?("#{area}.osrm.tiemstamp").should == true
end
Then /^I should see the file "([^"]*)"$/ do |file|
+24
View File
@@ -0,0 +1,24 @@
When /^I request \/(.*)$/ do |path|
osrm_kill
reprocess
OSRMLauncher.new do
@response = request_path path
end
end
Then /^I should get a response/ do
@response.code.should == "200"
@response.body.should_not == nil
@response.body.should_not == ''
end
Then /^response should be valid JSON$/ do
@json = JSON.parse @response.body
end
Then /^response should be well-formed$/ do
@json['version'].class.should == Float
@json['status'].class.should == Fixnum
@json['transactionId'].class.should == String
end
+3 -15
View File
@@ -12,25 +12,13 @@ When /^I request a route from "([^"]*)" to "([^"]*)"$/ do |a,b|
@response = request_route "#{locations[a][0]},#{locations[a][1]}", "#{locations[b][0]},#{locations[b][1]}"
end
Then /^I should get a response/ do
@response.code.should == "200"
@response.body.should_not == nil
@response.body.should_not == ''
end
Then /^response should be valid JSON$/ do
@json = JSON.parse @response.body
end
Then /^response should be well-formed$/ do
@json['version'].class.should == Float
@json['status'].class.should == Fixnum
Then /^response should be a well-formed route$/ do
step "response should be well-formed"
@json['status_message'].class.should == String
@json['route_summary'].class.should == Hash
@json['route_geometry'].class.should == String
@json['route_instructions'].class.should == Array
@json['via_points'].class.should == Array
@json['transactionId'].class.should == String
end
Then /^a route should be found$/ do
@@ -46,7 +34,7 @@ end
Then /^I should get a valid response$/ do
step "I should get a response"
step "response should be valid JSON"
step "response should be well-formed"
step "response should be a well-formed route"
#step "no error should be reported in terminal"
end
+7
View File
@@ -0,0 +1,7 @@
Then /^I should get a valid timestamp/ do
step "I should get a response"
step "response should be valid JSON"
step "response should be well-formed"
@json['timestamp'].class.should == String
@json['timestamp'].should == OSM_TIMESTAMP
end