Commit 269ba250 by Jon Yurek

Merge branch 'master' of git://github.com/mvanholstyn/paperclip

parents 066c1069 a1d03756
...@@ -137,7 +137,7 @@ module Paperclip ...@@ -137,7 +137,7 @@ module Paperclip
attachment.instance.class.name.underscore.pluralize attachment.instance.class.name.underscore.pluralize
end, end,
:basename => lambda do |attachment,style| :basename => lambda do |attachment,style|
attachment.original_filename.gsub(/\.(.*?)$/, "") attachment.original_filename.gsub(File.extname(attachment.original_filename), "")
end, end,
:extension => lambda do |attachment,style| :extension => lambda do |attachment,style|
((style = attachment.styles[style]) && style.last) || ((style = attachment.styles[style]) && style.last) ||
......
...@@ -110,6 +110,15 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -110,6 +110,15 @@ class AttachmentTest < Test::Unit::TestCase
assert_equal "/tests/original/missing.png", @attachment.url assert_equal "/tests/original/missing.png", @attachment.url
assert_equal "/tests/blah/missing.png", @attachment.url(:blah) assert_equal "/tests/blah/missing.png", @attachment.url(:blah)
end end
should "return the proper path when filename has a single .'s" do
assert_equal "./test/../tmp/tests/dummies/original/41/5k.png", @attachment.path
end
should "return the proper path when filename has multiple .'s" do
@instance.stubs(:[]).with(:test_file_name).returns("5k.old.png")
assert_equal "./test/../tmp/tests/dummies/original/41/5k.old.png", @attachment.path
end
context "with a file assigned in the database" do context "with a file assigned in the database" do
setup do setup do
......
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