adapt JSON parsing in tests to allow for omitted fields
This commit is contained in:
parent
a80815d57a
commit
2d498cb88b
@ -93,11 +93,13 @@ def route_status response
|
||||
end
|
||||
|
||||
def extract_instruction_list instructions, index, postfix=nil
|
||||
if instructions
|
||||
instructions.reject { |r| r[0].to_s=="#{DESTINATION_REACHED}" }.
|
||||
map { |r| r[index] }.
|
||||
map { |r| (r=="" || r==nil) ? '""' : "#{r}#{postfix}" }.
|
||||
join(',')
|
||||
end
|
||||
end
|
||||
|
||||
def way_list instructions
|
||||
extract_instruction_list instructions, 1
|
||||
@ -112,6 +114,7 @@ def bearing_list instructions
|
||||
end
|
||||
|
||||
def turn_list instructions
|
||||
if instructions
|
||||
types = {
|
||||
0 => :none,
|
||||
1 => :straight,
|
||||
@ -140,6 +143,7 @@ def turn_list instructions
|
||||
end
|
||||
end.join(',')
|
||||
end
|
||||
end
|
||||
|
||||
def mode_list instructions
|
||||
extract_instruction_list instructions, 8
|
||||
|
Loading…
Reference in New Issue
Block a user