test/test_wand.rb in wand-0.1 vs test/test_wand.rb in wand-0.2

- old
+ new

@@ -3,11 +3,11 @@ class TestWand < Test::Unit::TestCase context "Wand" do setup do Wand.executable = `which file`.chomp end - + { 'AVGARDD.svg' => 'image/svg+xml', 'compressed.zip' => 'application/zip', 'favicon.ico' => 'image/vnd.microsoft.icon', 'index.html' => 'text/html', @@ -41,8 +41,18 @@ end should "allow setting the executable" do Wand.executable = '/usr/local/bin/file' assert_equal '/usr/local/bin/file', Wand.executable + end + + should "strip newlines and such" do + Wand.expects(:execute_file_cmd).returns("image/jpeg\n") + assert_equal "image/jpeg", Wand.wave(FilePath.join(name).expand_path.to_s) + end + + should "escape path" do + output = Wand.execute_file_cmd(FilePath.join(name).expand_path.to_s + ' && echo $USER') + assert_match /cannot\sopen/, output end end end