summaryrefslogtreecommitdiff
path: root/spec/shapes/path_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/shapes/path_spec.rb')
-rw-r--r--spec/shapes/path_spec.rb25
1 files changed, 23 insertions, 2 deletions
diff --git a/spec/shapes/path_spec.rb b/spec/shapes/path_spec.rb
index 646acfa..f6df8c0 100644
--- a/spec/shapes/path_spec.rb
+++ b/spec/shapes/path_spec.rb
@@ -32,11 +32,24 @@ describe Scale::Path do
XML
expect(subject.to_xml).to eql(expected)
end
+
+ it 'moves horizontally using relative position' do
+ subject.move_to(x: 10, y: 10)
+ subject.horizontal(90, relative: true)
+ expected = <<-XML
+<?xml version="1.0"?>
+<path d="M10 10 h 90"/>
+ XML
+ expect(subject.to_xml).to eql(expected)
+ end
end
describe "#vertial" do
- it 'draws a horizontal line' do
+ before :each do
subject.move_to(x: 10, y: 10)
+ end
+
+ it 'draws a vertical line' do
subject.vertical(90)
expected = <<-XML
<?xml version="1.0"?>
@@ -44,6 +57,15 @@ describe Scale::Path do
XML
expect(subject.to_xml).to eql(expected)
end
+
+ it 'draws a vertical line relative to the current position' do
+ subject.vertical(90, relative: true)
+ expected = <<-XML
+<?xml version="1.0"?>
+<path d="M10 10 v 90"/>
+ XML
+ expect(subject.to_xml).to eql(expected)
+ end
end
describe "#close_path" do
@@ -74,5 +96,4 @@ describe Scale::Path do
expect(subject.to_xml).to eql(expected)
end
end
-
end