Commit a93dfc77 by Johan van Zonneveld Committed by Jon Yurek

Return name of style in processor_options

parent 94a1154e
...@@ -71,7 +71,7 @@ module Paperclip ...@@ -71,7 +71,7 @@ module Paperclip
# Arguments other than the standard geometry, format etc are just passed through from # Arguments other than the standard geometry, format etc are just passed through from
# initialization and any procs are called here, just before post-processing. # initialization and any procs are called here, just before post-processing.
def processor_options def processor_options
args = {} args = {:style => name}
@other_args.each do |k,v| @other_args.each do |k,v|
args[k] = v.respond_to?(:call) ? v.call(attachment) : v args[k] = v.respond_to?(:call) ? v.call(attachment) : v
end end
......
...@@ -31,6 +31,10 @@ class StyleTest < Test::Unit::TestCase ...@@ -31,6 +31,10 @@ class StyleTest < Test::Unit::TestCase
assert_equal [:thumbnail], @style[:processors] assert_equal [:thumbnail], @style[:processors]
assert_equal "100x100#", @style[:geometry] assert_equal "100x100#", @style[:geometry]
end end
should "return the name of the style in processor options" do
assert_equal :foo, @style.processor_options[:style]
end
end end
context "A style rule with properties supplied as procs" do context "A style rule with properties supplied as procs" do
...@@ -67,6 +71,7 @@ class StyleTest < Test::Unit::TestCase ...@@ -67,6 +71,7 @@ class StyleTest < Test::Unit::TestCase
@attachment = attachment :path => ":basename.:extension", @attachment = attachment :path => ":basename.:extension",
:styles => styles :styles => styles
end end
should "have the right number of styles" do should "have the right number of styles" do
assert_kind_of Hash, @attachment.styles assert_kind_of Hash, @attachment.styles
assert_equal 3, @attachment.styles.size assert_equal 3, @attachment.styles.size
......
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