Sha256: abac323ee789c877160991696b16e0cda0e79385eafd93e1694f36c305b8460a
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
require './test/helper' class AbstractAdapterTest < Test::Unit::TestCase class TestAdapter < Paperclip::AbstractAdapter attr_accessor :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 [:binmode, :binmode?, :close, :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 should 'get rid of slashes and colons in filenames' do @adapter = TestAdapter.new @adapter.original_filename = "awesome/file:name.png" assert_equal "awesome_file_name.png", @adapter.original_filename end should 'be an assignment' do assert TestAdapter.new.assignment? end should 'not be nil' do assert !TestAdapter.new.nil? end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
paperclip-3.5.4 | test/io_adapters/abstract_adapter_test.rb |
paperclip-3.5.3 | test/io_adapters/abstract_adapter_test.rb |