Commit 7ec26d2
Changed files (2)
lib
scale
shapes
spec
shapes
lib/scale/shapes/path.rb
@@ -3,6 +3,10 @@ module Scale
include Node
attribute :d, String
+ def move_to(x:, y:)
+ self.d="M#{x} #{y}"
+ end
+
def xml_tag
:path
end
spec/shapes/path_spec.rb
@@ -0,0 +1,10 @@
+describe Scale::Path do
+ it 'moves' do
+ subject.move_to(x: 10, y: 10)
+ expected = <<-XML
+<?xml version="1.0"?>
+<path d="M10 10"/>
+ XML
+ expect(subject.to_xml).to eql(expected)
+ end
+end