lib/pah/files/spec/support/uploaded_file.rb in pah-0.0.15 vs lib/pah/files/spec/support/uploaded_file.rb in pah-0.0.16

- old
+ new

@@ -1,17 +1,16 @@ -# -*- encoding : utf-8 -*- module UploadFileTestHelper - def uploaded_file(filename, content_type = "text/csv") - t = Tempfile.new([filename.split("/").last, filename.split(".").last]) + def uploaded_file(filename, content_type = 'text/csv') + t = Tempfile.new([filename.split('/').last, filename.split('.').last]) t.binmode - path = File.join(Rails.root, "spec", "fixtures", filename) + path = File.join(Rails.root, 'spec', 'fixtures', filename) FileUtils.copy_file(path, t.path) - ActionDispatch::Http::UploadedFile.new({ - filename: filename, - head: "Content-Disposition: form-data; name=\"file\"; filename=\"#{filename}\"\r\nContent-Type: #{content_type}\r\n", - type: content_type, - tempfile: t - }) + ActionDispatch::Http::UploadedFile.new( + filename: filename, + head: "Content-Disposition: form-data; name=\"file\"; filename=\"#{filename}\"\r\nContent-Type: #{content_type}\r\n", + type: content_type, + tempfile: t + ) end end RSpec.configure do |config| config.include UploadFileTestHelper