Sha256: cd3c81a8b7af4920b637b35e5f5f9bb65a944f7782ab0fc1ab52d86d10fa14cc
Contents?: true
Size: 833 Bytes
Versions: 3
Compression:
Stored size: 833 Bytes
Contents
require 'test_helper' class RedisFileTest < ActiveSupport::TestCase teardown do FileUpload::Engine.config.redis.flushdb end test "can preserve attributes" do tf = FileUpload::RedisFile.new({ :file_io => Rack::Test::UploadedFile.new(File.expand_path('../../fixtures/avatar.jpeg', __FILE__)), }) assert_equal("image/jpeg", tf.type) assert(tf.save, "should be able to save the file to redis") tf2 = FileUpload::RedisFile.find(tf.id) assert_equal(tf.key, tf2.key) assert_equal("avatar.jpeg", tf2.name) assert_equal("image/jpeg", tf2.type) end test "can detect file type" do tf = FileUpload::RedisFile.new({ :file_io => Rack::Test::UploadedFile.new(File.expand_path('../../fixtures/test_upload.txt', __FILE__)), }) assert_equal("text/plain", tf.type) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
file_upload-0.0.3 | test/unit/redis_file_test.rb |
file_upload-0.0.2 | test/unit/redis_file_test.rb |
file_upload-0.0.1 | test/unit/redis_file_test.rb |