Sha256: c9719d3839374f6599c36fc4bf922d9fc89bba0a3020cd4a0c439cf71dbe99db

Contents?: true

Size: 1.69 KB

Versions: 3

Compression:

Stored size: 1.69 KB

Contents

require "spec_helper"

describe Fontcustom::Base do
  before(:each) { allow(Fontcustom::Manifest).to receive(:write_file) }

  context "#compile" do
    context "when [:checksum][:current] equals [:checksum][:previous]" do
      it "should show 'no change' message" do
        allow(Fontcustom::Base).to receive(:check_fontforge)
        options = double("options")
        allow(options).to receive(:options).and_return({})
        allow(Fontcustom::Options).to receive(:new).and_return options

        output = capture(:stdout) do
          base = Fontcustom::Base.new({})
          manifest = base.instance_variable_get :@manifest
          expect(manifest).to receive(:get).and_return :previous => "abc"
          expect(base).to receive(:checksum).and_return "abc"
          base.compile
        end
        expect(output).to match(/No changes/)
      end
    end
  end

  context ".check_fontforge" do
    it "should raise error if fontforge isn't installed" do
      allow_any_instance_of(Fontcustom::Base).to receive(:"`").and_return("")
      expect { Fontcustom::Base.new(:option => "foo") }.to raise_error Fontcustom::Error, /fontforge/
    end
  end

  context ".checksum" do
    it "should return hash of all vectors and templates" do
      pending "SHA2 is different on CI servers. Why?"
      allow(Fontcustom::Base).to receive(:check_fontforge)
      base = Fontcustom::Base.new({})
      base.instance_variable_set :@options, {
        :input => {:vectors => fixture("shared/vectors")},
        :templates => Dir.glob(File.join(fixture("shared/templates"), "*"))
      }
      hash = base.send :checksum
      hash.should == "81ffd2f72877be02aad673fdf59c6f9dbfee4cc37ad0b121b9486bc2923b4b36"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fontcustom-1.3.5 spec/fontcustom/base_spec.rb
fontcustom-1.3.5.pre spec/fontcustom/base_spec.rb
fontcustom-1.3.4 spec/fontcustom/base_spec.rb