Sha256: b14b95576faa3132eb1b4435642231a3a75ee4c8b53f1e52f25689abdee43c3f
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
# encoding: utf-8 require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper") describe "ImageHandler" do let(:image_handler) { Prawn::ImageHandler.new } let(:handler_a) { mock("Handler A") } let(:handler_b) { mock("Handler B") } it "finds the image handler for an image" do handler_a.expects(:can_render? => true) image_handler.register(handler_a) image_handler.register(handler_b) handler = image_handler.find("arbitrary blob") handler.should == handler_a end it "can prepend handlers" do handler_b.expects(:can_render? => true) image_handler.register(handler_a) image_handler.register!(handler_b) handler = image_handler.find("arbitrary blob") handler.should == handler_b end it "raises an error when no matching handler is found" do handler_a.expects(:can_render? => false) handler_b.expects(:can_render? => false) image_handler.register(handler_a) image_handler.register(handler_b) expect { image_handler.find("arbitrary blob") }. to(raise_error(Prawn::Errors::UnsupportedImageType)) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
prawn-0.13.2 | spec/image_handler_spec.rb |
prawn-0.13.1 | spec/image_handler_spec.rb |
prawn-0.13.0 | spec/image_handler_spec.rb |