Sha256: 183ab09fe7979ed501c1fe6582b8f64b7a3c37f99c5db6e5407066bbe7597696

Contents?: true

Size: 851 Bytes

Versions: 1

Compression:

Stored size: 851 Bytes

Contents

require 'spec_helper'
require 'pry'
require 'json'

describe Gpx2geojson do
  subject { Gpx2geojson.new }

  describe 'convert' do
    it 'converts a (Garmin) file to JSON' do
      file = File.open('./spec/fixtures/elevator_shaft_garmin.gpx')
      parsed = JSON.parse(Gpx2geojson.parse(file))

      expect(parsed["type"]).to eq("Feature")
      expect(parsed["geometry"]["type"]).to eq("MultiLineString")
      expect(parsed['geometry']['coordinates'][0].length).to eq(5)
    end

    it 'converts a non-Garmin GPX file to GeoJSON' do
      file = File.open('./spec/fixtures/holy_x_non_garmin.gpx')
      parsed = JSON.parse(Gpx2geojson.parse(file))

      expect(parsed["type"]).to eq("Feature")
      expect(parsed["geometry"]["type"]).to eq("MultiLineString")
      expect(parsed['geometry']['coordinates'][0].length).to eq(5)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gpx2geojson-1.0.0 spec/gpx2geojson_spec.rb