main
1describe Scale::DSL do
2 subject { Scale::DSL.new }
3
4 it 'produce the proper svg via the DSL' do
5 result = subject.run do |x|
6 x.rectangle(width: "100%", height: "100%", fill: "red")
7 x.circle(cx: 150, cy: 100, r: 80, fill: "green")
8 x.text("SVG", x: 150, y: 125, font_size: 60, text_anchor: 'middle', fill: "white")
9 end
10
11 expected = <<-XML
12<?xml version="1.0\"?>
13<svg xmlns="http://www.w3.org/2000/svg" version="1.1" baseProfile="full">
14 <rect width="100%" height="100%" fill="red"/>
15 <circle cx="150" cy="100" r="80"/>
16 <text x="150" y="125" font-size="60">SVG</text>
17</svg>
18 XML
19
20 expect(result).to eql(expected)
21 end
22end