Sha256: 0e9449dc06f3c2d0d7810da7e311039e70178a3f70ca20ae387e9fab0a94aebf

Contents?: true

Size: 838 Bytes

Versions: 2

Compression:

Stored size: 838 Bytes

Contents

require "rubygems"
require "tempfile"
require "pathname"
require "test/unit"
require "shoulda"
require "shoulda/context"
require "mime/types"
require "rack/utils"
require "rack/mock"

begin
  require "pry"
rescue LoadError
  # Pry is not available, just ignore.
end

ROOT = Pathname(File.expand_path(File.join(File.dirname(__FILE__), "..")))

require File.join(ROOT, "lib", "paperclip", "rack")

def multipart_fixture(name, boundary = "AaB03x")
  file = multipart_file(name)
  data = File.open(file, 'rb') { |io| io.read }

  type = "multipart/form-data; boundary=#{boundary}"
  length = data.respond_to?(:bytesize) ? data.bytesize : data.size

  { "CONTENT_TYPE" => type,
    "CONTENT_LENGTH" => length.to_s,
    :input => StringIO.new(data) }
end

def multipart_file(name)
  File.join(File.dirname(__FILE__), "multipart", name.to_s)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paperclip-rack-0.0.2 test/helper.rb
paperclip-rack-0.0.1 test/helper.rb