Sha256: 18fcad5f63b72b8728a9cd779016a41951a9eebee70db04952173ed63eb5352b

Contents?: true

Size: 885 Bytes

Versions: 3

Compression:

Stored size: 885 Bytes

Contents

# encoding: utf-8
require File.expand_path('xpath_matchers', File.dirname(__FILE__))

module WordprocessingMLMatchers
	extend RSpec::Matchers::DSL
	include XPathMatchers

	def contain_body
		exist_xpath('//w:document/w:body')
	end

	def contain_paragraph_text
		exist_xpath('//w:p/w:r/w:t')
	end

	def contain_paragraph_run
		exist_xpath('//w:p/w:r')
	end

	def contain_element_property(el, prop)
		exist_xpath("//w:#{el}/w:#{el}Pr/w:#{prop}")
	end

	def contain_element_style(el)
		contain_element_property(el, 'pStyle')
	end

	# TODO: These a not the same, fix it

	def contain_gallery_of_document_parts
		exist_xpath('//w:sdt/w:sdtPr/w:docPartObj/w:docPartGallery')
	end

	def contain_sdt_content_heading
		exist_xpath('//w:sdt/w:sdtPr/w:docPartObj/w:docPartGallery')
	end

	def contain_table_of_contents
		contain_gallery_of_document_parts &&
		contain_sdt_content_heading
	end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
docxtor2-0.0.9 spec/docxtor2/support/matchers/wordprocessingml_matchers.rb
docxtor-0.1.1 spec/docxtor/support/matchers/wordprocessingml_matchers.rb
docxtor2-0.1.0 spec/docxtor2/support/matchers/wordprocessingml_matchers.rb