Sha256: 09bfd03481541e40ac3a6becbda28a1181073871d71c4cfdfb2f821561d892d5
Contents?: true
Size: 1.1 KB
Versions: 4
Compression:
Stored size: 1.1 KB
Contents
require "spec_helper" RSpec.describe Vectory::SvgMapping do context "no namespace" do let(:source) { Vectory::SvgMapping.from_path("doc.xml") } let(:reference) { File.read("doc-ref.xml") } let(:work_dir) { "spec/examples/svg" } it "rewrites ids" do Dir.chdir(work_dir) do content = source.call expect(xmlpp(strip_image_and_style(content))) .to be_equivalent_to xmlpp(reference) end end end context "with namespaces" do let(:source) { Vectory::SvgMapping.from_path("doc2.xml") } let(:reference) { File.read("doc2-ref.xml") } let(:work_dir) { "spec/examples/svg" } it "rewrites ids" do Dir.chdir(work_dir) do content = source.call expect(xmlpp(strip_image(content))) .to be_equivalent_to xmlpp(reference) end end end def strip_image(xml) xml.gsub(%r{<image.*?</image>}m, "<image/>") end def strip_image_and_style(xml) xml.gsub(%r{<image.*?</image>}m, "<image/>") .gsub(%r{<style.*?</style>}m, "<style/>") # rubocop:disable Layout/MultilineMethodCallIndentation end end
Version data entries
4 entries across 4 versions & 1 rubygems