Sha256: a510507c95e175532c04cee4c61dff868e2730eb19dfa4ebe39f6b8ec50b1919

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe LiquidDiagrams::Renderers::BlockdiagRenderer do
  subject(:renderer) { described_class.new('content') }

  describe '#render' do
    include_examples 'render with tempfile', described_class
  end

  describe '#build_command' do
    context 'when config is empty' do
      it { expect(renderer.build_command).to eq 'blockdiag -T svg --nodoctype' }
    end

    context 'when config is not empty' do
      before do
        renderer.instance_variable_set(:@config, { 'size' => 10 })
      end

      it 'build command with config' do
        expect(renderer.build_command).to match '--size=10'
      end
    end

    context 'when switch is true' do
      it 'build command' do
        renderer.instance_variable_set(:@config, { 'antialias' => true })

        expect(renderer.build_command).to match '--antialias'
      end
    end

    context 'when switch is false' do
      it 'build command' do
        renderer.instance_variable_set(:@config, { 'antialias' => false })

        expect(renderer.build_command).not_to match '--antialias'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
liquid-diagrams-0.3.0 spec/liquid_diagrams/renderers/blockdiag_renderer_spec.rb
liquid-diagrams-0.2.0 spec/liquid_diagrams/renderers/blockdiag_renderer_spec.rb
liquid-diagrams-0.1.0 spec/liquid_diagrams/renderers/blockdiag_renderer_spec.rb