Sha256: 34a0bfd76fb039831f0c78ce9da9827b538866e085c9046f4badd26093957e49
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
require "spec_helper" RSpec.describe Fontist::Finder do describe ".find" do context "with valid font name" do it "returns the fonts path" do name = "DejaVuSerif.ttf" stub_system_font_finder_to_fixture(name) dejavu_ttf = Fontist::Finder.find(name) expect(dejavu_ttf.first).to include(name) end end context "with downloadable ms vista font" do it "returns missing font error" do name = "CALIBRI.TTF" allow(Fontist::SystemFont).to receive(:find).and_return(nil) expect { Fontist::Finder.find(name) }.to raise_error(Fontist::Errors::MissingFontError) end end context "with invalid font name" do it "raise an missing font error" do font_name = "InvalidFont.ttf" expect { Fontist::Finder.find(font_name) }.to raise_error(Fontist::Errors::NonSupportedFontError) end end end def stub_system_font_finder_to_fixture(name) allow(Fontist::SystemFont).to receive(:find). and_return(["spec/fixtures/fonts/#{name}"]) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fontist-0.3.0 | spec/fontist/finder_spec.rb |
fontist-0.2.0 | spec/fontist/finder_spec.rb |