From 4c1a238f145a5832966b13da89499fb88df1d87d Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Thu, 1 Jun 2023 21:42:17 +1000 Subject: [PATCH] Update specs --- spec/actions/trips/index_spec.rb | 10 - spec/actions/trips/show_spec.rb | 10 - spec/adamantium/unit/geo/gpx_parser_spec.rb | 21 + .../slices/admin/actions/trips/create_spec.rb | 10 - spec/slices/admin/actions/trips/index_spec.rb | 10 - spec/slices/admin/actions/trips/new_spec.rb | 10 - spec/slices/admin/actions/trips/show_spec.rb | 10 - .../slices/admin/actions/trips/update_spec.rb | 10 - spec/support/fixtures/geo.gpx | 759 ++++++++++++++++++ spec/support/fixtures/geo.svg | 170 ++++ 10 files changed, 950 insertions(+), 70 deletions(-) delete mode 100644 spec/actions/trips/index_spec.rb delete mode 100644 spec/actions/trips/show_spec.rb create mode 100644 spec/adamantium/unit/geo/gpx_parser_spec.rb delete mode 100644 spec/slices/admin/actions/trips/create_spec.rb delete mode 100644 spec/slices/admin/actions/trips/index_spec.rb delete mode 100644 spec/slices/admin/actions/trips/new_spec.rb delete mode 100644 spec/slices/admin/actions/trips/show_spec.rb delete mode 100644 spec/slices/admin/actions/trips/update_spec.rb create mode 100644 spec/support/fixtures/geo.gpx create mode 100644 spec/support/fixtures/geo.svg diff --git a/spec/actions/trips/index_spec.rb b/spec/actions/trips/index_spec.rb deleted file mode 100644 index b2fc161..0000000 --- a/spec/actions/trips/index_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Adamantium::Actions::Trips::Index do - let(:params) { Hash[] } - - it "works" do - response = subject.call(params) - expect(response).to be_successful - end -end diff --git a/spec/actions/trips/show_spec.rb b/spec/actions/trips/show_spec.rb deleted file mode 100644 index cfe98d6..0000000 --- a/spec/actions/trips/show_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Adamantium::Actions::Trips::Show do - let(:params) { Hash[] } - - it "works" do - response = subject.call(params) - expect(response).to be_successful - end -end diff --git a/spec/adamantium/unit/geo/gpx_parser_spec.rb b/spec/adamantium/unit/geo/gpx_parser_spec.rb new file mode 100644 index 0000000..21854a1 --- /dev/null +++ b/spec/adamantium/unit/geo/gpx_parser_spec.rb @@ -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 \ No newline at end of file diff --git a/spec/slices/admin/actions/trips/create_spec.rb b/spec/slices/admin/actions/trips/create_spec.rb deleted file mode 100644 index 1acb7e4..0000000 --- a/spec/slices/admin/actions/trips/create_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Admin::Actions::Trips::Create do - let(:params) { Hash[] } - - it "works" do - response = subject.call(params) - expect(response).to be_successful - end -end diff --git a/spec/slices/admin/actions/trips/index_spec.rb b/spec/slices/admin/actions/trips/index_spec.rb deleted file mode 100644 index f994d7f..0000000 --- a/spec/slices/admin/actions/trips/index_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Admin::Actions::Trips::Index do - let(:params) { Hash[] } - - it "works" do - response = subject.call(params) - expect(response).to be_successful - end -end diff --git a/spec/slices/admin/actions/trips/new_spec.rb b/spec/slices/admin/actions/trips/new_spec.rb deleted file mode 100644 index 773ec19..0000000 --- a/spec/slices/admin/actions/trips/new_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Admin::Actions::Trips::New do - let(:params) { Hash[] } - - it "works" do - response = subject.call(params) - expect(response).to be_successful - end -end diff --git a/spec/slices/admin/actions/trips/show_spec.rb b/spec/slices/admin/actions/trips/show_spec.rb deleted file mode 100644 index b6c121e..0000000 --- a/spec/slices/admin/actions/trips/show_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Admin::Actions::Trips::Show do - let(:params) { Hash[] } - - it "works" do - response = subject.call(params) - expect(response).to be_successful - end -end diff --git a/spec/slices/admin/actions/trips/update_spec.rb b/spec/slices/admin/actions/trips/update_spec.rb deleted file mode 100644 index 6fb5dd2..0000000 --- a/spec/slices/admin/actions/trips/update_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Admin::Actions::Trips::Update do - let(:params) { Hash[] } - - it "works" do - response = subject.call(params) - expect(response).to be_successful - end -end diff --git a/spec/support/fixtures/geo.gpx b/spec/support/fixtures/geo.gpx new file mode 100644 index 0000000..c6a096e --- /dev/null +++ b/spec/support/fixtures/geo.gpx @@ -0,0 +1,759 @@ + + + + + ]]> + + + + + + + + + + + + 1564.683 + + + + 1563.721 + + + + 1565.164 + + + + 1565.645 + + + + 1565.164 + + + + 1566.125 + + + + 1566.125 + + + + 1565.645 + + + + 1566.606 + + + + 1566.606 + + + + 1566.606 + + + + 1566.606 + + + + 1567.086 + + + + 1566.606 + + + + 1567.086 + + + + 1566.606 + + + + 1566.606 + + + + 1567.086 + + + + 1568.528 + + + + + + 1570.451 + + + + 1570.451 + + + + 1572.374 + + + + 1572.374 + + + + 1573.335 + + + + 1573.335 + + + + 1575.257 + + + + 1575.257 + + + + 1575.257 + + + + 1575.257 + + + + 1574.777 + + + + 1572.854 + + + + 1569.97 + + + + 1569.49 + + + + 1565.645 + + + + 1563.721 + + + + 1562.76 + + + + 1559.876 + + + + 1560.357 + + + + 1560.357 + + + + 1560.838 + + + + 1557.954 + + + + 1562.28 + + + + 1561.799 + + + + 1560.838 + + + + 1560.357 + + + + 1561.799 + + + + 1559.876 + + + + 1561.799 + + + + 1561.799 + + + + 1561.799 + + + + 1561.318 + + + + 1560.838 + + + + 1561.318 + + + + 1563.721 + + + + 1564.202 + + + + 1564.202 + + + + 1564.202 + + + + 1562.28 + + + + 1563.241 + + + + 1563.721 + + + + 1564.683 + + + + 1564.202 + + + + 1565.645 + + + + 1565.645 + + + + 1565.645 + + + + 1565.645 + + + + 1569.97 + + + + 1571.412 + + + + 1572.374 + + + + 1569.97 + + + + 1570.451 + + + + 1569.49 + + + + 1569.009 + + + + 1570.932 + + + + 1571.893 + + + + 1572.374 + + + + 1572.374 + + + + 1572.374 + + + + 1570.451 + + + + 1567.086 + + + + 1566.606 + + + + 1565.645 + + + + 1566.606 + + + + 1565.164 + + + + 1566.125 + + + + 1567.086 + + + + 1570.451 + + + + 1573.335 + + + + 1577.18 + + + + 1576.699 + + + + 1577.661 + + + + 1577.661 + + + + 1577.661 + + + + 1578.622 + + + + 1579.103 + + + + 1576.219 + + + + 1576.219 + + + + 1576.219 + + + + 1575.738 + + + + 1576.219 + + + + 1577.661 + + + + 1578.622 + + + + 1579.103 + + + + 1580.064 + + + + 1581.026 + + + + 1581.506 + + + + 1581.987 + + + + 1581.026 + + + + 1581.506 + + + + + + 1582.948 + + + + + + 1582.468 + + + + 1584.871 + + + + 1587.755 + + + + 1586.313 + + + + 1592.081 + + + + 1592.561 + + + + 1594.003 + + + + 1592.561 + + + + 1588.716 + + + + 1585.832 + + + + 1582.468 + + + + 1583.429 + + + + 1581.026 + + + + 1580.064 + + + + 1580.545 + + + + 1580.545 + + + + 1582.468 + + + + 1585.351 + + + + 1586.313 + + + + 1587.274 + + + + 1585.832 + + + + 1588.235 + + + + 1588.716 + + + + 1589.197 + + + + 1588.235 + + + + 1588.235 + + + + 1585.351 + + + + 1585.351 + + + + 1584.39 + + + + 1584.39 + + + + 1584.871 + + + + 1584.871 + + + + 1584.39 + + + + 1584.871 + + + + 1584.871 + + + + 1586.313 + + + + 1587.274 + + + + 1586.793 + + + + 1588.235 + + + + 1588.235 + + + + 1587.755 + + + + 1589.197 + + + + 1589.677 + + + + 1589.197 + + + + 1588.716 + + + + 1590.158 + + + + 1589.677 + + + + 1591.6 + + + + 1589.677 + + + + 1589.677 + + + + 1593.522 + + + + 1592.081 + + + + 1592.081 + + + + 1590.638 + + + + 1589.197 + + + + 1591.119 + + + + 1590.638 + + + + 1590.158 + + + + 1587.755 + + + + 1589.197 + + + + 1589.197 + + + + + + 1590.158 + + + + 1590.158 + + + + + + 1584.39 + + + + 1585.351 + + + + 1586.313 + + + + 1588.716 + + + + 1589.677 + + + + 1586.313 + + + + + + 1575.738 + + + + 1572.854 + + + + + + 1267.155 + + + + \ No newline at end of file diff --git a/spec/support/fixtures/geo.svg b/spec/support/fixtures/geo.svg new file mode 100644 index 0000000..67a26b8 --- /dev/null +++ b/spec/support/fixtures/geo.svg @@ -0,0 +1,170 @@ + + + + + + +Gnuplot + +Produced by GNUPLOT 5.4 patchlevel 6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +gnuplot_plot_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +