Commit 6ced9eb3 by Mike Burns

Remove the restriction on Processor ancestry.

parent d00c04e3
...@@ -104,9 +104,6 @@ module Paperclip ...@@ -104,9 +104,6 @@ module Paperclip
name = name.to_s.camelize name = name.to_s.camelize
load_processor(name) unless Paperclip.const_defined?(name) load_processor(name) unless Paperclip.const_defined?(name)
processor = Paperclip.const_get(name) processor = Paperclip.const_get(name)
unless processor.ancestors.include?(Paperclip::Processor)
raise PaperclipError.new("Processor #{name} was not found")
end
processor processor
end end
......
...@@ -447,6 +447,10 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -447,6 +447,10 @@ class AttachmentTest < Test::Unit::TestCase
context "An attachment with :processors that is a proc" do context "An attachment with :processors that is a proc" do
setup do setup do
class Paperclip::Test < Paperclip::Processor; end
@file = StringIO.new("...")
Paperclip::Test.stubs(:make).returns(@file)
rebuild_model :styles => { :normal => '' }, :processors => lambda { |a| [ :test ] } rebuild_model :styles => { :normal => '' }, :processors => lambda { |a| [ :test ] }
@attachment = Dummy.new.avatar @attachment = Dummy.new.avatar
end end
......
...@@ -25,10 +25,6 @@ class PaperclipTest < Test::Unit::TestCase ...@@ -25,10 +25,6 @@ class PaperclipTest < Test::Unit::TestCase
end end
end end
should "raise when sent #processor and the name of a class that exists but isn't a subclass of Processor" do
assert_raises(Paperclip::PaperclipError){ Paperclip.processor(:attachment) }
end
should "raise when sent #processor and the name of a class that doesn't exist" do should "raise when sent #processor and the name of a class that doesn't exist" do
assert_raises(NameError){ Paperclip.processor(:boogey_man) } assert_raises(NameError){ Paperclip.processor(:boogey_man) }
end end
......
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