diff options
| author | mo khan <mo@mokhan.ca> | 2015-04-08 15:28:37 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-04-08 15:28:37 -0600 |
| commit | c7363e63f3d6d60debe3721cecf3354d1904405d (patch) | |
| tree | ea4fb9824bb13bda0db2ed544fb18879a9cbae7f /spec/shapes/path_spec.rb | |
| parent | 208d393e2a282ceceee463e8d887bd2bfce4ce6e (diff) | |
add relative movements.
Diffstat (limited to 'spec/shapes/path_spec.rb')
| -rw-r--r-- | spec/shapes/path_spec.rb | 25 |
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 |
