test/test_wand.rb in wand-0.3 vs test/test_wand.rb in wand-0.4
- old
+ new
@@ -1,11 +1,11 @@
require 'helper'
class TestWand < Test::Unit::TestCase
context "Wand" do
setup do
- Wand.executable = `which file`.chomp
+ Wand.executable = nil
end
{
'AVGARDD.svg' => 'image/svg+xml',
'compressed.zip' => 'application/zip',
@@ -60,9 +60,18 @@
assert_equal "text/plain", Wand.wave('')
end
should "return nil if file output matches cannot" do
Wand.expects(:execute_file_cmd).returns("cannot open file")
+ assert_equal nil, Wand.wave('')
+ end
+
+ should "properly handle bad stuff" do
+ assert_nothing_raised { Wand.wave(';blah') }
+ end
+
+ should "handle unexpected results frome execute file command" do
+ Wand.expects(:execute_file_cmd).returns('')
assert_equal nil, Wand.wave('')
end
end
end