Sha256: 5092611432c77bbd03eee8c26037b901938f9d9bee97c1004b303edf9b9c5d7f
Contents?: true
Size: 1.01 KB
Versions: 4
Compression:
Stored size: 1.01 KB
Contents
require './test/helper' class AbstractAdapterTest < Test::Unit::TestCase class TestAdapter < Paperclip::AbstractAdapter attr_accessor :original_file_name, :tempfile def content_type Paperclip::ContentTypeDetector.new(path).detect end end context "content type from file command" do setup do @adapter = TestAdapter.new @adapter.stubs(:path).returns("image.png") end should "return the content type without newline" do assert_equal "image/png", @adapter.content_type end end context "nil?" do should "return false" do assert !TestAdapter.new.nil? end end context "delegation" do setup do @adapter = TestAdapter.new @adapter.tempfile = stub("Tempfile") end [:close, :closed?, :eof?, :path, :rewind, :unlink].each do |method| should "delegate #{method} to @tempfile" do @adapter.tempfile.stubs(method) @adapter.public_send(method) assert_received @adapter.tempfile, method end end end end
Version data entries
4 entries across 4 versions & 1 rubygems