Commit fab4aea3 by Adam Milligan Committed by Jon Yurek

Make #expiring_url behavior consistent with #url

Return the default path when the attachment has no remote file
parent 8a9690f3
......@@ -164,6 +164,8 @@ module Paperclip
if path
base_options = { :expires => time, :secure => use_secure_protocol?(style_name) }
s3_object(style_name).url_for(:read, base_options.merge(s3_url_options)).to_s
else
url
end
end
......
......@@ -539,6 +539,18 @@ class S3Test < Test::Unit::TestCase
end
end
context "#expiring_url" do
setup { @dummy = Dummy.new }
context "with no attachment" do
setup { assert(!@dummy.avatar.exists?) }
should "return the default URL" do
assert_equal(@dummy.avatar.url, @dummy.avatar.expiring_url)
end
end
end
context "Generating a url with an expiration for each style" do
setup do
rebuild_model :storage => :s3,
......
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