Commit 56477408 by Jon Yurek

Procs are working inside geomety specifications again.

parent 75d10b91
......@@ -303,6 +303,9 @@ module Paperclip
:convert_options => extra_options_for(name)
}.merge(@styles[name])
end
if @styles[name][:geometry].respond_to?(:call)
@styles[name][:geometry] = @styles[name][:geometry].call(instance)
end
end
end
......
......@@ -170,6 +170,24 @@ class AttachmentTest < Test::Unit::TestCase
end
end
geometry_specs = [
[ lambda{|z| "50x50#" }, :png ],
lambda{|z| "50x50#" },
{ :geometry => lambda{|z| "50x50#" } }
]
geometry_specs.each do |geometry_spec|
context "An attachment geomtry like #{geometry_spec}" do
setup do
rebuild_model :styles => { :normal => geometry_spec }
@attachment = Dummy.new.avatar
end
should "have the correct geometry" do
assert_equal "50x50#", @attachment.styles[:normal][:geometry]
end
end
end
context "An attachment with both 'normal' and hash-style styles" do
setup do
rebuild_model :styles => {
......
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