1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
# coding: utf-8
require "spec_helper"
describe PDF::Reader::WidthCalculator::BuiltIn do
it_behaves_like "a WidthCalculator duck type" do
let!(:font) { double(:basefont => :Helvetica) }
subject { PDF::Reader::WidthCalculator::BuiltIn.new(font)}
end
end
describe PDF::Reader::WidthCalculator::BuiltIn, "#initialize" do
context "when the basefont is one of the 14 standard fonts" do
let!(:font) { double(:basefont => :Helvetica) }
it "should initialize with no errors" do
lambda {
PDF::Reader::WidthCalculator::BuiltIn.new(font)
}.should_not raise_error
end
end
context "when the basefont is not one of the 14 standard fonts" do
let!(:font) { double(:basefont => :Foo) }
it "should raise an error" do
lambda {
PDF::Reader::WidthCalculator::BuiltIn.new(font)
}.should raise_error(ArgumentError)
end
end
end
|