routing 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/routing/parser/here_simple.rb +15 -9
- data/lib/routing/version.rb +1 -1
- data/spec/fixtures/here/{response_with_rounding_errors.json → response_with_non_simple_mapping.json} +0 -0
- data/spec/fixtures/here/response_with_non_simple_mapping_2.json +21037 -0
- data/spec/routing/parser/here_simple_spec.rb +18 -6
- metadata +6 -4
@@ -71,22 +71,34 @@ describe Routing::Parser::HereSimple do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'raises an exception if no matching original position was found' do
|
74
|
-
expect { subject }.to raise_error(Routing::Parser::NoMatchingMappedPositionFound)
|
74
|
+
expect { subject }.to raise_error(Routing::Parser::NoMatchingMappedPositionFound, 'Mapped waypoints did not match with geopoint')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context 'when response does not contain enough waypoints to map them on the maneuvers' do
|
79
|
+
let(:response) do
|
80
|
+
corrupted_response = JSON.parse(fixture('here/response.json'))
|
81
|
+
corrupted_response['response']['route'].first['waypoint'].pop
|
82
|
+
JSON.dump(corrupted_response)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'raises an exception if no matching original position was found' do
|
86
|
+
expect { subject }.to raise_error(Routing::Parser::NoMatchingMappedPositionFound, 'No more waypoints available')
|
75
87
|
end
|
76
88
|
end
|
77
89
|
end
|
78
90
|
end
|
79
91
|
end
|
80
92
|
|
81
|
-
# The fixture used here shows a response from the Here routing service that contains
|
82
|
-
#
|
93
|
+
# The fixture used here shows a response from the Here routing service that contains different
|
94
|
+
# values in the following fields:
|
83
95
|
# route[] > waypoint[] > mappedPosition > latitude/longitude
|
84
96
|
# route[] > leg[] > maneuver > position > latitude/longitude
|
85
97
|
#
|
86
|
-
# This two fields are supposed to
|
98
|
+
# This two fields are supposed to contain the same values I think. Yet, they sometimes differ,
|
87
99
|
# which caused the parser to fail. This spec assures the parser still works.
|
88
|
-
context 'with a successful, but very large routing response that
|
89
|
-
let(:response) { fixture('here/
|
100
|
+
context 'with a successful, but very large routing response that is not mappable by coordinates' do
|
101
|
+
let(:response) { fixture('here/response_with_non_simple_mapping_2.json') }
|
90
102
|
let(:json_response) { JSON.parse(response) }
|
91
103
|
|
92
104
|
describe '#to_geo_points' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: routing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Bäuerlein
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-06-
|
12
|
+
date: 2015-06-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -112,7 +112,8 @@ files:
|
|
112
112
|
- routing.gemspec
|
113
113
|
- spec/fixtures/here/error_response.json
|
114
114
|
- spec/fixtures/here/response.json
|
115
|
-
- spec/fixtures/here/
|
115
|
+
- spec/fixtures/here/response_with_non_simple_mapping.json
|
116
|
+
- spec/fixtures/here/response_with_non_simple_mapping_2.json
|
116
117
|
- spec/fixtures/navteq/error_response.json
|
117
118
|
- spec/fixtures/navteq/response.json
|
118
119
|
- spec/routing/adapter/here_spec.rb
|
@@ -149,7 +150,8 @@ summary: A ruby interface for route calculation services
|
|
149
150
|
test_files:
|
150
151
|
- spec/fixtures/here/error_response.json
|
151
152
|
- spec/fixtures/here/response.json
|
152
|
-
- spec/fixtures/here/
|
153
|
+
- spec/fixtures/here/response_with_non_simple_mapping.json
|
154
|
+
- spec/fixtures/here/response_with_non_simple_mapping_2.json
|
153
155
|
- spec/fixtures/navteq/error_response.json
|
154
156
|
- spec/fixtures/navteq/response.json
|
155
157
|
- spec/routing/adapter/here_spec.rb
|