[rspec-users] rspec and prawn

Phlip phlip2005 at gmail.com
Tue Mar 10 07:47:15 EDT 2009

aa aa wrote:
> Hi,
> I've just started using prawn but am at a bit of a loss how to create my
> view specs for it.
> For example, my normal view spec has things like
> response.should have_tag("blah")
> or
> response.body.should =~ /something/
> How do I do this with prawn output?

In what language is prawn output?

Generally speaking, a View is 2D or 3D, yet our tests must run in 1 dimension. 
In HTML, we do that by parsing the elements back into a DOM, and inspecting 
this. We don't necessarily do it by rendering a page and looking at it!

So if prawn were PS, can you get a post script parser, parse it, and look for 
your details?

(Note, too, that .should =~ is only a cheap approximation of parsing...)


More information about the rspec-users mailing list