Sha256: b4091ccad14f1f231d0c2b9e261b5272313e0f913778e137d047715f666bb913
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
require 'spec_helper' describe Prawn::Svg::Parser::Path do before :each do @path = Prawn::Svg::Parser::Path.new end describe "command parsing" do it "correctly parses a valid path" do calls = [] @path.stub!(:run_path_command) {|*args| calls << args} @path.parse("A12.34 -56.78 89B4 5 C 6,7 T QX 0 Z") calls.should == [ ["A", [12.34, -56.78, 89]], ["B", [4, 5]], ["C", [6, 7]], ["T", []], ["Q", []], ["X", [0]], ["Z", []] ] end it "correctly parses an empty path" do @path.should_not_receive(:run_path_command) @path.parse("").should == [] @path.parse(" ").should == [] end it "raises on invalid characters in the path" do lambda {@path.parse("M 10 % 20")}.should raise_error(Prawn::Svg::Parser::Path::InvalidError) end it "raises on numerical data before a command letter" do lambda {@path.parse("10 P")}.should raise_error(Prawn::Svg::Parser::Path::InvalidError) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
prawn-svg-0.12.0.8 | spec/lib/path_spec.rb |
prawn-svg-0.12.0.7 | spec/lib/path_spec.rb |
prawn-svg-0.12.0.6 | spec/lib/path_spec.rb |
prawn-svg-0.12.0.4 | spec/lib/path_spec.rb |