Commit 91f673f2 by Jon Yurek

Apparently copy_to_local_file wasn't in the FS module

parent d01d58c2
......@@ -67,10 +67,10 @@ module Paperclip
end
@queued_for_delete = []
end
end
def copy_to_local_file(style, local_dest_path)
FileUtils.cp(path(style), local_dest_path)
def copy_to_local_file(style, local_dest_path)
FileUtils.cp(path(style), local_dest_path)
end
end
end
......
......@@ -204,4 +204,4 @@ module Paperclip
end
end
end
end
\ No newline at end of file
end
......@@ -41,6 +41,14 @@ class FileSystemTest < Test::Unit::TestCase
assert paths.none?{ |path| File.exists?(path) },
"Expect all the files to be deleted."
end
should 'copy the file to a known location with copy_to_local_file' do
tempfile = Tempfile.new("known_location")
@dummy.avatar.copy_to_local_file(:original, tempfile.path)
tempfile.rewind
assert_equal @file.read, tempfile.read
tempfile.close
end
end
context "with file that has space in file name" do
......
......@@ -149,6 +149,17 @@ class FogTest < Test::Unit::TestCase
"Expect all the files to be deleted."
end
should 'be able to be copied to a local file' do
@dummy.save
tempfile = Tempfile.new("known_location")
tempfile.binmode
@dummy.avatar.copy_to_local_file(:original, tempfile.path)
tempfile.rewind
assert_equal @connection.directories.get(@fog_directory).files.get(@dummy.avatar.path).body,
tempfile.read
tempfile.close
end
should "pass the content type to the Fog::Storage::AWS::Files instance" do
Fog::Storage::AWS::Files.any_instance.expects(:create).with do |hash|
hash[:content_type]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment