Update specs
This commit is contained in:
21
spec/adamantium/unit/geo/gpx_parser_spec.rb
Normal file
21
spec/adamantium/unit/geo/gpx_parser_spec.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
require "spec_helper"
|
||||
|
||||
RSpec.describe Adamantium::Geo::GpxParser do
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
let(:gpx_file) { File.join(SPEC_ROOT, "support", "fixtures", "geo.gpx") }
|
||||
let(:expected_svg) { File.read(File.join(SPEC_ROOT, "support", "fixtures", "geo.svg")) }
|
||||
|
||||
it "parses a gpx file" do
|
||||
# puts gpx_file.inspect
|
||||
result = subject.call(path: gpx_file).value!
|
||||
|
||||
parsed_svg = Nokogiri::XML::Document.parse(result[:svg])
|
||||
svg = Nokogiri::XML::Document.parse(expected_svg)
|
||||
expect(parsed_svg.xpath("//title")).to eq svg.xpath("//title")
|
||||
expect(result[:distance]).to eq 3.0724966849262554
|
||||
expect(result[:duration]).to eq 15237.0
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user