Commit 58a17e64 by Overbryd

Added a test for Attachment#uploaded_file

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