Sha256: 95bf32d1acdbf454fb1cd4b451f1046498d812ffa2e3c6f0e9549e7525f20eb3

Contents?: true

Size: 1.5 KB

Versions: 8

Compression:

Stored size: 1.5 KB

Contents

require "spec_helper"

RSpec.describe Fontist::Registry do
  describe ".register" do
    context "with no key provided" do
      it "registers a fontist formula with default key" do
        Fontist::Registry.register(Fontist::Formulas::DemoFormula)
        demo_formula = Fontist::Registry.formulas.demo_formula

        expect(demo_formula.license).to eq("Vendor specific font licences")
        expect(demo_formula.fonts.first.styles.first.type).to eq("Regular")
        expect(demo_formula.installer).to eq("Fontist::Formulas::DemoFormula")
        expect(demo_formula.homepage).to eq("https://github.com/fontist/fontist")
      end
    end

    context "with custom key provided" do
      it "registers the formula with this custom key" do
        Fontist::Registry.register(Fontist::Formulas::DemoFormula, :custom_key)

        expect(Fontist::Registry.formulas.custom_key).not_to be_nil
      end
    end
  end

  module Fontist
    module Formulas
      class DemoFormula < FontFormula
        key :demo_formula
        desc "Demo font formula"
        homepage "https://github.com/fontist/fontist"
        requires_license_agreement "Vendor specific font licences"

        resource "demo-formula" do
          urls [ "https://github.com/fontist/fontist" ]
          sha256 "594e0f42e6581add4dead70c1dfb9"
          file_size "1234567890"
        end

        provides_font "Demo font", match_styles_from_file: {
          "Regular" => "demo-font.ttf",
          "Italic" => "demo-fonti.ttf"
        }
      end
    end
  end
end

Version data entries

8 entries across 7 versions & 2 rubygems

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