+ def test_import_handles_bz2
+ FakeFS do
+ FakeFS::FileSystem.clone(Rails.root.join("test", "gpx"))
+ trace = create(:trace, :fixture => "c")
+
+ trace.import
+
+ assert_equal 1, trace.size
+ end
+ end
+
+ def test_import_handles_plain
+ FakeFS do
+ FakeFS::FileSystem.clone(Rails.root.join("test", "gpx"))
+ trace = create(:trace, :fixture => "a")
+
+ trace.import
+
+ assert_equal 1, trace.size
+ end
+ end
+
+ def test_import_handles_plain_with_bom
+ FakeFS do
+ FakeFS::FileSystem.clone(Rails.root.join("test", "gpx"))
+ trace = create(:trace, :fixture => "b")
+
+ trace.import
+
+ assert_equal 1, trace.size
+ end
+ end
+
+ def test_import_handles_gz
+ trace = create(:trace, :fixture => "d")
+
+ FakeFS do
+ FakeFS::FileSystem.clone(Rails.root.join("test", "gpx"))
+ trace.import
+
+ assert_equal 1, trace.size
+ ensure
+ trace.destroy
+ end
+ end
+
+ def test_import_handles_zip
+ trace = create(:trace, :fixture => "f")
+
+ FakeFS do
+ FakeFS::FileSystem.clone(Rails.root.join("test", "gpx"))
+ trace.import
+
+ assert_equal 2, trace.size
+ ensure
+ trace.destroy
+ end
+ end
+
+ def test_import_handles_tar
+ trace = create(:trace, :fixture => "g")
+
+ FakeFS do
+ FakeFS::FileSystem.clone(Rails.root.join("test", "gpx"))
+ trace.import
+
+ assert_equal 2, trace.size
+ ensure
+ trace.destroy
+ end
+ end
+
+ def test_import_handles_tar_gz
+ trace = create(:trace, :fixture => "h")
+
+ FakeFS do
+ FakeFS::FileSystem.clone(Rails.root.join("test", "gpx"))
+ trace.import
+
+ assert_equal 2, trace.size
+ ensure
+ trace.destroy
+ end
+ end
+
+ def test_import_handles_tar_bz2
+ trace = create(:trace, :fixture => "i")
+
+ FakeFS do
+ FakeFS::FileSystem.clone(Rails.root.join("test", "gpx"))
+ trace.import
+
+ assert_equal 2, trace.size
+ ensure
+ trace.destroy
+ end
+ end
+