test/scavenger_test.rb in scavenger-0.2.0 vs test/scavenger_test.rb in scavenger-0.2.1
- old
+ new
@@ -23,9 +23,16 @@
def test_can_compress_file
expected_output = "<symbol viewBox=\"0 0 173 173\" id=\"hejsna\" preserveAspectRatio=\"xMinYMin meet\"><g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g transform=\"translate(1.000000, 1.000000)\"><circle stroke=\"#979797\" fill=\"#D8D8D8\" cx=\"85.5\" cy=\"85.5\" r=\"85.5\"></circle><path d=\"M83.5,117.5 L83.5,51.5\" stroke=\"#A80C0C\" stroke-linecap=\"square\" fill=\"#A80C0C\"></path><path d=\"M83.5,51.5 L80.5,62.3 L86.5,62.3 L83.5,51.5 Z\" stroke=\"#A80C0C\" stroke-linecap=\"square\" fill=\"#A80C0C\"></path><polygon stroke=\"#979797\" fill=\"#D8D8D8\" points=\"39 92 20.1908719 101.888544 23.7830957 80.9442719 8.56619148 66.1114562 29.595436 63.0557281 39 44 48.404564 63.0557281 69.4338085 66.1114562 54.2169043 80.9442719 57.8091281 101.888544\"></polygon><polygon fill=\"#EB8D8D\" points=\"125 56 154 114 96 114\"></polygon></g></g></symbol>"
assert_equal expected_output, @compressor.compress_file("./test/svg/hejsna.svg", "hejsna.svg")
end
+ def test_adds_id_prefixes
+ Scavenger::Config.id_prefix = "foo-"
+ expected_output = "<symbol viewBox=\"0 0 173 173\" id=\"foo-hejsna\" preserveAspectRatio=\"xMinYMin meet\"><g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g transform=\"translate(1.000000, 1.000000)\"><circle stroke=\"#979797\" fill=\"#D8D8D8\" cx=\"85.5\" cy=\"85.5\" r=\"85.5\"></circle><path d=\"M83.5,117.5 L83.5,51.5\" stroke=\"#A80C0C\" stroke-linecap=\"square\" fill=\"#A80C0C\"></path><path d=\"M83.5,51.5 L80.5,62.3 L86.5,62.3 L83.5,51.5 Z\" stroke=\"#A80C0C\" stroke-linecap=\"square\" fill=\"#A80C0C\"></path><polygon stroke=\"#979797\" fill=\"#D8D8D8\" points=\"39 92 20.1908719 101.888544 23.7830957 80.9442719 8.56619148 66.1114562 29.595436 63.0557281 39 44 48.404564 63.0557281 69.4338085 66.1114562 54.2169043 80.9442719 57.8091281 101.888544\"></polygon><polygon fill=\"#EB8D8D\" points=\"125 56 154 114 96 114\"></polygon></g></g></symbol>"
+ assert_equal expected_output, @compressor.compress_file("./test/svg/hejsna.svg", "hejsna.svg")
+ Scavenger::Config.id_prefix = ""
+ end
+
def test_creates_sprite_file
@compressor.compress_dir
assert File.exist?(@sprite_path)
end
end