Commit f9cb5a4e by Jon Yurek

Ensure correct behavior when assigning empty string

parent e54b5bdf
......@@ -985,6 +985,20 @@ class AttachmentTest < Test::Unit::TestCase
end
end
should 'clear out the previous assignment when assigned nil' do
@attachment.assign(@file)
original_file = @attachment.queued_for_write[:original]
@attachment.assign(nil)
assert_nil @attachment.queued_for_write[:original]
end
should 'not do anything when it is assigned an empty string' do
@attachment.assign(@file)
original_file = @attachment.queued_for_write[:original]
@attachment.assign("")
assert_equal original_file, @attachment.queued_for_write[:original]
end
should "return nil as path when no file assigned" do
assert_equal nil, @attachment.path
assert_equal nil, @attachment.path(:blah)
......
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