Sha256: b7d02787895daeec5f0b683084f7fa90ea53833c549b926db5b5278d383dedff
Contents?: true
Size: 1.4 KB
Versions: 7
Compression:
Stored size: 1.4 KB
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" stroke="black" />' } it "renders the line" do subject.process expect(subject.base_calls).to eq [ ["stroke_color", ["000000"], []], ["stroke", [], [ ["move_to", [[5.0, 590.0]], []], ["line_to", [[15.0, 580.0]], []]] ] ] end end context "with no attributes nor stroke specified" do let(:svg) { '<line />' } it "outlines a path from 0,0 to 0,0" do subject.process expect(subject.base_calls).to eq [ ["end_path", [], [ ["move_to", [[0, 600]], []], ["line_to", [[0, 600]], []]] ] ] end end context "with a fill specified" do let(:svg) { '<line x1="0" y1="0" x2="15" y2="20" style="stroke: red; fill: blue;" />' } it "ignores the fill" do subject.process expect(subject.base_calls).to eq [ ["fill_color", ["0000ff"], []], ["stroke_color", ["ff0000"], []], ["stroke", [], [ ["move_to", [[0, 600]], []], ["line_to", [[15.0, 580.0]], []]] ] ] end end end
Version data entries
7 entries across 7 versions & 1 rubygems