Sha256: 16e23024c9bc7d88cf2b9211aff8211fb76cfef05e3e2bfce3ae29eba37d9c48
Contents?: true
Size: 646 Bytes
Versions: 1
Compression:
Stored size: 646 Bytes
Contents
class RailsExtras module RSpec module Support module Common def upload_file(path, options={}) filename = path.split('/').last.to_s.force_encoding("UTF-8") tempfile = File.new(Rails.root.join('spec', 'files', path)) hash = {tempfile: tempfile, filename: filename} hash[:original_filename] = options[:original_filename] if options[:original_filename] hash[:content_type] = options[:content_type] || 'text/plain' hash[:headers] = options[:headers] if options[:headers] ::ActionDispatch::Http::UploadedFile.new(hash) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_extras-0.1.2 | lib/rails_extras/rspec/support/common.rb |