Sha256: 3913933b384760a3a873ec2303f322b22c37f1633f2a10af57134219ca3c71e8

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

require "spec_helper"

RSpec.describe Fontist::Formulas::ClearTypeFonts do
  describe "initializing" do
    it "builds the data dictionary" do
      formula = Fontist::Formulas::ClearTypeFonts.instance

      expect(formula.fonts.count).to eq(12)
      expect(formula.fonts[1][:name]).to eq("Cambria Math")
      expect(formula.fonts.first[:name]).to eq("Cambria")
    end
  end

  describe "installation" do
    context "with valid licence agreement", slow: true do
      it "installs the valid fonts", skip_in_windows: true do
        name = "Calibri"
        confirmation = "yes"

        paths = Fontist::Formulas::ClearTypeFonts.fetch_font(
          name, confirmation: confirmation
        )

        expect(paths.first).to include("fonts/#{name.upcase}.TTF")
      end
    end

    context "with missing licence agreement" do
      it "raises an Fontist::Errors::LicensingError" do
        name = "Calibri"

        expect {
          Fontist::Formulas::ClearTypeFonts.fetch_font(name, confirmation: "no")
        }.to raise_error(Fontist::Errors::LicensingError)
      end
    end
  end
end

Version data entries

8 entries across 7 versions & 2 rubygems

Version Path
fontist-1.3.0 spec/fontist/formulas/cleartype_fonts_spec.rb
fontist-1.2.1 spec/fontist/formulas/cleartype_fonts_spec.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/fontist-1.1.0/spec/fontist/formulas/cleartype_fonts_spec.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/fontist-1.2.0/spec/fontist/formulas/cleartype_fonts_spec.rb
fontist-1.2.0 spec/fontist/formulas/cleartype_fonts_spec.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/fontist-1.1.0/spec/fontist/formulas/cleartype_fonts_spec.rb
fontist-1.1.0 spec/fontist/formulas/cleartype_fonts_spec.rb
fontist-1.0.0 spec/fontist/formulas/cleartype_fonts_spec.rb