Sha256: 3fc920d7aad2bcd1c2e3192c92fa81eceb25b969663d77b6f53a889fe339c20e

Contents?: true

Size: 1016 Bytes

Versions: 9

Compression:

Stored size: 1016 Bytes

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe Prawn::SVG::Document do
  let(:bounds) { [100, 100] }
  let(:options) { {} }

  describe "#initialize" do
    context "when unparsable XML is provided" do
      let(:svg) { "this isn't SVG data" }

      it "raises an exception" do
        expect {
          Prawn::SVG::Document.new(svg, bounds, options)
        }.to raise_error Prawn::SVG::Document::InvalidSVGData, "The data supplied is not a valid SVG document."
      end
    end

    context "when the user passes in a filename instead of SVG data" do
      let(:svg) { "some_file.svg" }

      it "raises an exception letting them know what they've done" do
        expect {
          Prawn::SVG::Document.new(svg, bounds, options)
        }.to raise_error Prawn::SVG::Document::InvalidSVGData, "The data supplied is not a valid SVG document.  It looks like you've supplied a filename instead; use IO.read(filename) to get the data before you pass it to prawn-svg."
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
prawn-svg-0.32.0 spec/prawn/svg/document_spec.rb
prawn-svg-0.31.0 spec/prawn/svg/document_spec.rb
prawn-svg-0.30.0 spec/prawn/svg/document_spec.rb
prawn-svg-0.29.1 spec/prawn/svg/document_spec.rb
prawn-svg-0.29.0 spec/prawn/svg/document_spec.rb
prawn-svg-0.28.0 spec/prawn/svg/document_spec.rb
prawn-svg-0.25.2 spec/prawn/svg/document_spec.rb
prawn-svg-0.25.1 spec/prawn/svg/document_spec.rb
prawn-svg-0.25.0 spec/prawn/svg/document_spec.rb