Sha256: 49e8b0e87eaa954b2c7d7edcb6b93d97784cb76689edd3eeea3e84c5142bdfdd

Contents?: true

Size: 764 Bytes

Versions: 2

Compression:

Stored size: 764 Bytes

Contents

require "spec_helper"

RSpec.describe Fontist::SystemFont do
  describe ".find" do
    context "with a vlaid existing font" do
      it "returns the complete font path" do
        name = "DejaVuSerif.ttf"
        dejavu_ttf = Fontist::SystemFont.find(name, sources: [font_sources])

        expect(dejavu_ttf).not_to be_nil
        expect(dejavu_ttf.first).to include("spec/fixtures/fonts/")
      end
    end

    context "with invalid font" do
      it "returns nill to the caller" do
        name = "invalid-font.ttf"
        invalid_font = Fontist::SystemFont.find(name, sources: [font_sources])

        expect(invalid_font).to be_nil
      end
    end
  end

  def font_sources
    @font_sources ||= Fontist.root_path.join("spec/fixtures/fonts/*")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fontist-0.3.0 spec/fontist/system_font_spec.rb
fontist-0.2.0 spec/fontist/system_font_spec.rb