pdf-inspector provides some useful methods for testing PDFs generated by Prawn. While testing strings is straightforward, I need a way to test that tables (generated by prawn-table) are generated correctly.
For example, I'm generating a table
rows = ['Name','Value']
@objects.each do |object|
rows << [object.name, object.value]
table(rows)
I would like to include something like the following in a test
let(:object} { create :object, name: 'Object', value: 10 }
let(:my_pdf) { MyPdf.new( #params ) }
it { expect(PDF::Inspector::Text.analyze( my_pdf ).strings ).to include "Object 10" }
This does not work because prawn-table does not generate this as a single string, but as "Object", "10".
Are there any libraries out there that people recommend for testing content generated by prawn-table. Or is there a standard way to do this?