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