Forum: RSpec rspec and prawn

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
aa a. (Guest)
on 2009-03-10 05:02
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?
Phlip (Guest)
on 2009-03-10 13:56
(Received via mailing list)
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...)

--
   Phlip
Zach D. (Guest)
on 2009-03-10 14:48
(Received via mailing list)
On Mon, Mar 9, 2009 at 11:02 PM, aa aa <removed_email_address@domain.invalid> 
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?

Short answer, you can't--at least not yet. PDF is not a plain text
markup language like HTML so its not a problem so easily solved. I
haven't spec'd a PDF, but when looking into it at one point I came
across PDF Reader.

http://github.com/yob/pdf-wrapper/tree

Perhaps that will help you find a starting place.


> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> removed_email_address@domain.invalid
> http://rubyforge.org/mailman/listinfo/rspec-users
>



--
Zach D.
http://www.continuousthinking.com
http://www.mutuallyhuman.com
Phlip (Guest)
on 2009-03-10 14:50
(Received via mailing list)
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?

How do prawn's own unit tests work?
Zach D. (Guest)
on 2009-03-10 15:04
(Received via mailing list)
On Tue, Mar 10, 2009 at 8:43 AM, Zach D. <removed_email_address@domain.invalid>
wrote:
>
> Short answer, you can't--at least not yet. PDF is not a plain text
> markup language like HTML so its not a problem so easily solved. I
> haven't spec'd a PDF, but when looking into it at one point I came
> across PDF Reader.
>
> http://github.com/yob/pdf-wrapper/tree

Oops wrong URL:

http://github.com/yob/pdf-reader/tree

>>
>
>
>
> --
> Zach D.
> http://www.continuousthinking.com
> http://www.mutuallyhuman.com
>



--
Zach D.
http://www.continuousthinking.com
http://www.mutuallyhuman.com
This topic is locked and can not be replied to.