Sha256: 621252404acabd96c28b0f4f1f9083a5cbb4d20166a063cfe2766220baf186b9

Contents?: true

Size: 585 Bytes

Versions: 11

Compression:

Stored size: 585 Bytes

Contents

module PartTestMacros

  def xml(part)
    File.read(File.join(File.dirname(__FILE__), "data", "parts", "#{part}_part.xml")).lines.map(&:strip).join
  end

  def self.included(base)
    attr_reader :doc
    base.extend ClassMethods
  end

  module ClassMethods

    def it_should_output_correct_xml(part: nil)
      it "should be able to output the correct XML" do
        if part.nil?
          part = described_class.to_s.split(/::/).last
          part = part.gsub(/(.)([A-Z])/, '\1_\2').downcase
        end

        expect(doc.read).to eq(xml(part))
      end
    end

  end

end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
openxml-docx-0.10.6 spec/support/part_test_macros.rb
openxml-docx-0.10.5 spec/support/part_test_macros.rb
openxml-docx-0.10.4 spec/support/part_test_macros.rb
openxml-docx-0.10.3 spec/support/part_test_macros.rb
openxml-docx-0.10.2 spec/support/part_test_macros.rb
openxml-docx-0.10.1 spec/support/part_test_macros.rb
openxml-docx-0.10.0 spec/support/part_test_macros.rb
openxml-docx-0.9.0 spec/support/part_test_macros.rb
openxml-docx-0.8.0 spec/support/part_test_macros.rb
openxml-docx-0.8.0.beta1 spec/support/part_test_macros.rb
rocx-0.7.0 spec/support/part_test_macros.rb