test/paperclip_test.rb in paperclip-2.3.16 vs test/paperclip_test.rb in paperclip-2.4.0

- old
+ new

@@ -23,14 +23,10 @@ end assert_same_elements @expected, actual 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 assert_raises(NameError){ Paperclip.processor(:boogey_man) } end should "return a class when sent #processor and the name of a class under Paperclip" do @@ -273,7 +269,29 @@ assert [@dummy.errors[:avatar_file_size]].flatten.any?{|error| error =~ %r/lambda between 0 and 10240 bytes/ } end end end + end + + context "configuring a custom processor" do + setup do + @freedom_processor = Class.new do + def make(file, options = {}, attachment = nil) + file + end + end.new + + Paperclip.configure do |config| + config.register_processor(:freedom, @freedom_processor) + end + end + + should "be able to find the custom processor" do + assert_equal @freedom_processor, Paperclip.processor(:freedom) + end + + teardown do + Paperclip.clear_processors! + end end end