Sha256: 18245ef1c74ecd54f50ea2c93dccec61e9efbd036b3024ca34c00e85c15d3d05

Contents?: true

Size: 907 Bytes

Versions: 4

Compression:

Stored size: 907 Bytes

Contents

require 'spec_helper'

RSpec.describe Prawn::SVG::Elements::Line do
  let(:document) { Prawn::SVG::Document.new(svg, [800, 600], {width: 800, height: 600}) }

  subject do
    Prawn::SVG::Elements::Line.new(document, document.root, [], fake_state)
  end

  context "with attributes specified" do
    let(:svg) { '<line x1="5" y1="10" x2="15" y2="20" />' }

    it "renders the line" do
      subject.process
      expect(subject.base_calls).to eq [
        ["fill", [], [
          ["move_to", [[5.0, 590.0]], []],
          ["line_to", [[15.0, 580.0]], []]]
        ]
      ]
    end
  end

  context "with no attributes specified" do
    let(:svg) { '<line />' }

    it "draws a line from 0,0 to 0,0" do
      subject.process
      expect(subject.base_calls).to eq [
        ["fill", [], [
          ["move_to", [[0, 600]], []],
          ["line_to", [[0, 600]], []]]
        ]
      ]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
prawn-svg-0.26.0 spec/prawn/svg/elements/line_spec.rb
prawn-svg-0.25.2 spec/prawn/svg/elements/line_spec.rb
prawn-svg-0.25.1 spec/prawn/svg/elements/line_spec.rb
prawn-svg-0.25.0 spec/prawn/svg/elements/line_spec.rb