+ def test_import_creates_icon
+ trace = create(:trace, :inserted => false, :fixture => "a")
+
+ assert_not_predicate trace.icon, :attached?
+
+ trace.import
+
+ assert_predicate trace.icon, :attached?
+ end
+
+ def test_import_creates_large_picture
+ trace = create(:trace, :inserted => false, :fixture => "a")
+
+ assert_not_predicate trace.image, :attached?
+
+ trace.import
+
+ assert_predicate trace.image, :attached?
+ end
+
+ def test_import_handles_bz2
+ trace = create(:trace, :inserted => false, :fixture => "c")
+
+ trace.import
+
+ assert_equal 1, trace.size
+ end
+
+ def test_import_handles_plain
+ trace = create(:trace, :inserted => false, :fixture => "a")
+
+ trace.import
+
+ assert_equal 1, trace.size
+ end
+
+ def test_import_handles_plain_with_bom
+ trace = create(:trace, :inserted => false, :fixture => "b")
+
+ trace.import
+
+ assert_equal 1, trace.size
+ end
+
+ def test_import_handles_gz
+ trace = create(:trace, :inserted => false, :fixture => "d")
+
+ trace.import
+
+ assert_equal 1, trace.size
+ end
+
+ def test_import_handles_zip
+ trace = create(:trace, :inserted => false, :fixture => "f")
+
+ trace.import
+
+ assert_equal 2, trace.size
+ end
+
+ def test_import_handles_tar
+ trace = create(:trace, :inserted => false, :fixture => "g")
+
+ trace.import
+
+ assert_equal 2, trace.size
+ end
+
+ def test_import_handles_tar_gz
+ trace = create(:trace, :inserted => false, :fixture => "h")
+
+ trace.import
+
+ assert_equal 2, trace.size
+ end
+
+ def test_import_handles_tar_bz2
+ trace = create(:trace, :inserted => false, :fixture => "i")
+
+ trace.import
+
+ assert_equal 2, trace.size
+ end
+
+ def test_import_enforces_limit
+ trace = create(:trace, :inserted => false, :fixture => "f")
+
+ with_settings(:max_trace_size => 1) do
+ assert_raise GPX::FileTooBigError do
+ trace.import
+ end
+ end
+
+ assert_not trace.inserted
+ end
+
+ private