Commit 58a17e64 by Overbryd

Added a test for Attachment#uploaded_file

parent 1655bf29
......@@ -95,7 +95,7 @@ module Paperclip
uploaded_file = uploaded_file.to_file(:original)
close_uploaded_file = uploaded_file.respond_to?(:close)
else
instance_write(:uploaded_file, uploaded_file)
instance_write(:uploaded_file, uploaded_file) if uploaded_file
end
return nil unless valid_assignment?(uploaded_file)
......@@ -208,7 +208,7 @@ module Paperclip
def original_filename
instance_read(:file_name)
end
# Returns the size of the file as originally assigned, and lives in the
# <attachment>_file_size attribute of the model.
def size
......
......@@ -825,6 +825,10 @@ class AttachmentTest < Test::Unit::TestCase
assert @attachment.dirty?
end
should "set uploaded_file for access beyond the paperclip lifecycle" do
assert_equal @file, @attachment.uploaded_file
end
context "and saved" do
setup do
@attachment.save
......
require 'rubygems'
require 'tempfile'
require 'pathname'
require 'test/unit'
require 'shoulda'
......
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