Skip to content

Commit

Permalink
Fix geojson test
Browse files Browse the repository at this point in the history
  • Loading branch information
niborg committed May 21, 2023
1 parent 44cc4f4 commit 2a48234
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/geojson_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ def test_line_string_functionality_with_lambda
gpx_file = GPX::GeoJSON.convert_to_gpx(
geojson_file: file,
line_string_feature_to_segment: lambda { |line_string, segment|
segment.distance = line_string['properties']['distance']
segment.points << GPX::Point.new(
{
lat: line_string['geometry']['coordinates'][0][1],
lon: line_string['geometry']['coordinates'][0][0]
}
)
}
)

Expand All @@ -68,10 +73,7 @@ def test_line_string_functionality_with_lambda
pts_size = gpx_file.tracks.first.segments[0].points.size +
gpx_file.tracks.first.segments[1].points.size +
gpx_file.tracks.first.segments[2].points.size
assert_equal(58, pts_size)
assert_equal(10, gpx_file.tracks.first.segments[0].distance)
assert_equal(100, gpx_file.tracks.first.segments[1].distance)
assert_equal(1_000, gpx_file.tracks.first.segments[2].distance)
assert_equal(61, pts_size)
end

def test_multi_line_string_functionality
Expand Down Expand Up @@ -107,7 +109,7 @@ def test_point_functionality
gpx_file = GPX::GeoJSON.convert_to_gpx(geojson_file: file)
assert_equal(3, gpx_file.waypoints.size)
end

def test_point_functionality_with_proc
file = File.join(File.dirname(__FILE__), 'geojson_files/point_data.json')
gpx_file = GPX::GeoJSON.convert_to_gpx(
Expand Down

0 comments on commit 2a48234

Please sign in to comment.