Permalink
Browse files

Make sure no newline from type_from_file_command

This relates to #817
  • Loading branch information...
sikachu committed Jun 8, 2012
1 parent 7332e51 commit 6728166896d58412e4d10276f010eca8c299890f
Showing with 21 additions and 1 deletion.
  1. +0 −1 lib/paperclip/io_adapters/abstract_adapter.rb
  2. +21 −0 test/io_adapters/abstract_adapter_test.rb
@@ -27,6 +27,5 @@ def type_from_file_command
mime_type = "application/x-#{type}" if mime_type.match(/\(.*?\)/)
mime_type
end
-
end
end
@@ -0,0 +1,21 @@
+require './test/helper'
+
+class AbstractAdapterTest < Test::Unit::TestCase
+ class TestAdapter < Paperclip::AbstractAdapter
+ attr_accessor :path, :original_file_name
+
+ def content_type
+ type_from_file_command
+ end
+ end
+
+ context "content type from file command" do
+ setup do
+ Paperclip.stubs(:run).returns("image/png\n")
+ end
+
+ should "return the content type without newline" do
+ assert_equal "image/png", TestAdapter.new.content_type
+ end
+ end
+end

0 comments on commit 6728166

Please sign in to comment.