Sha256: a21318a93df0f9d3450ae0d8e4ccc2cf04bd2673faf4f6bcef66c3bed54ccfa5

Contents?: true

Size: 657 Bytes

Versions: 3

Compression:

Stored size: 657 Bytes

Contents

require 'test_helper'

class RedisFileReadableTest < ActiveSupport::TestCase

  class TestFile
    attr_accessor :name, :content_type, :size, :data

    include FileUpload::RedisFileReadable
  end

  teardown do
    FileUpload::Engine.config.redis.flushdb
  end

  test "can load data from a key" do
    file = FileUpload::RedisFile.new({
      :file_io => Rack::Test::UploadedFile.new(File.expand_path('../../fixtures/avatar.jpeg', __FILE__)),
    })
    assert file.save

    tf = TestFile.new
    tf.key = file.id

    assert_equal("image/jpeg", tf.content_type)
    assert_equal("avatar.jpeg", tf.name)
    assert(tf.size)
    assert(tf.data)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
file_upload-0.0.3 test/unit/redis_file_readable_test.rb
file_upload-0.0.2 test/unit/redis_file_readable_test.rb
file_upload-0.0.1 test/unit/redis_file_readable_test.rb