Sha256: f9112f49d6fdc4b8b456a9cccb4ec56403b47519148c789a604903fb373e43e4

Contents?: true

Size: 886 Bytes

Versions: 7

Compression:

Stored size: 886 Bytes

Contents

require 'spec_helper'

describe Prawn::SVG::Elements::Root do
  let(:color_mode) { :rgb }
  let(:sizing) do
    instance_double(Prawn::SVG::Calculators::DocumentSizing, x_offset: 0, y_offset: 0, x_scale: 1, y_scale: 1)
  end
  let(:document) do
    instance_double(Prawn::SVG::Document, color_mode: color_mode, sizing: sizing)
  end
  let(:source) { double(name: 'svg', attributes: {}) }
  let(:state) { Prawn::SVG::State.new }
  let(:element) { Prawn::SVG::Elements::Root.new(document, source, [], state) }

  it 'uses RGB black as the default color' do
    element.apply
    expect(element.calls.first).to eq ['fill_color', ['000000'], {}, []]
  end

  context 'when in CMYK mode' do
    let(:color_mode) { :cmyk }

    it 'uses CMYK black as the default color' do
      element.apply
      expect(element.calls.first).to eq ['fill_color', [[0, 0, 0, 100]], {}, []]
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
prawn-svg-0.36.0 spec/prawn/svg/elements/root_spec.rb
prawn-svg-0.35.1 spec/prawn/svg/elements/root_spec.rb
prawn-svg-0.35.0 spec/prawn/svg/elements/root_spec.rb
prawn-svg-0.34.2 spec/prawn/svg/elements/root_spec.rb
prawn-svg-0.34.1 spec/prawn/svg/elements/root_spec.rb
prawn-svg-0.34.0 spec/prawn/svg/elements/root_spec.rb
prawn-svg-0.33.0 spec/prawn/svg/elements/root_spec.rb