Sha256: bcd4c36fdacf7c8bbca63f17c2594ae05e69f1661a05c51037cc1a4fee3f5e5a

Contents?: true

Size: 867 Bytes

Versions: 5

Compression:

Stored size: 867 Bytes

Contents

require 'spec_helper'

RSpec.describe Prawn::SVG::TTF do
  subject { Prawn::SVG::TTF.new(filename) }

  context 'with a truetype font' do
    let(:filename) { "#{File.dirname(__FILE__)}/../../sample_ttf/OpenSans-SemiboldItalic.ttf" }

    it 'gets the English family and subfamily from the font file' do
      expect(subject.family).to eq 'Open Sans'
      expect(subject.subfamily).to eq 'Semibold Italic'
    end
  end

  context "with a file that isn't a TTF" do
    let(:filename) { __FILE__ }

    it 'has a nil family and subfamily' do
      expect(subject.family).to be nil
      expect(subject.subfamily).to be nil
    end
  end

  context "with a file that doesn't exist" do
    let(:filename) { 'does_not_exist' }

    it 'has a nil family and subfamily' do
      expect(subject.family).to be nil
      expect(subject.subfamily).to be nil
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
prawn-svg-0.36.2 spec/prawn/svg/ttf_spec.rb
prawn-svg-0.36.1 spec/prawn/svg/ttf_spec.rb
prawn-svg-0.36.0 spec/prawn/svg/ttf_spec.rb
prawn-svg-0.35.1 spec/prawn/svg/ttf_spec.rb
prawn-svg-0.35.0 spec/prawn/svg/ttf_spec.rb