Browse files

Remove unnecessary mv/unlink from Filesystem#flush_writes, complicate…

…s some failure modes
  • Loading branch information...
1 parent 772c8e9 commit f8c244456d150c7b26440564feb085ce431d82c8 @kreynolds kreynolds committed Feb 6, 2012
Showing with 1 addition and 8 deletions.
  1. +1 −6 lib/paperclip/storage/filesystem.rb
  2. +0 −2 test/integration_test.rb
View
7 lib/paperclip/storage/filesystem.rb
@@ -38,12 +38,7 @@ def flush_writes #:nodoc:
file.close
FileUtils.mkdir_p(File.dirname(path(style_name)))
log("saving #{path(style_name)}")
- begin
- FileUtils.mv(file.path, path(style_name))
- rescue SystemCallError
- FileUtils.cp(file.path, path(style_name))
- FileUtils.rm(file.path)
- end
+ FileUtils.cp(file.path, path(style_name))
FileUtils.chmod(0666&~File.umask, path(style_name))
end
View
2 test/integration_test.rb
@@ -81,8 +81,6 @@ class IntegrationTest < Test::Unit::TestCase
original.close
tf.rewind
- File.expects(:unlink).with(tf.instance_variable_get(:@tmpname))
-
@d2.avatar.expects(:to_file).with(:original).returns(tf)
@d2.avatar.reprocess!

0 comments on commit f8c2444

Please sign in to comment.