webrat for validating responses

13 views
Skip to first unread message

Jarl Friis

unread,
Aug 31, 2010, 8:09:34 AM8/31/10
to web...@googlegroups.com, Bryan Helmkamp
Dear Bryan.

One claimed feature of webrat is
"Webrat::Matchers API for verifying rendered HTML using CSS, XPath,
etc. "

However the example does not give a clue as how to do this. cheat
webrat gives a minor clue (but it does not work)

I use webrat with rails. 'cheat webrat' gives the following example:

response.should have_selector('div.pagination')

but if I use that I get an error like this:
NoMethodError: undefined method `should' for #<ActionController::Response:0x7fcfd9204c88>

I believe I have configured webrat correct because the methods in the
webrat example works fine.

Please update the example to expose how to take advantage of
"Webrat::Matchers API for verifying rendered HTML using CSS, XPath,
etc. "

Thanks, Jarl

Matt Wynne

unread,
Aug 31, 2010, 8:56:21 AM8/31/10
to web...@googlegroups.com, Bryan Helmkamp

On 31 Aug 2010, at 13:09, Jarl Friis wrote:

> Dear Bryan.
>
> One claimed feature of webrat is
> "Webrat::Matchers API for verifying rendered HTML using CSS, XPath,
> etc. "
>
> However the example does not give a clue as how to do this. cheat
> webrat gives a minor clue (but it does not work)
>
> I use webrat with rails. 'cheat webrat' gives the following example:
>
> response.should have_selector('div.pagination')
>
> but if I use that I get an error like this:
> NoMethodError: undefined method `should' for #<ActionController::Response:0x7fcfd9204c88>

#should isn't a webrat method, it's an RSpec method. You need to make sure RSpec is installed and the right rspec files are required (depending on what version you want to use). Ask on the rspec list for details.

>
> I believe I have configured webrat correct because the methods in the
> webrat example works fine.
>
> Please update the example to expose how to take advantage of
> "Webrat::Matchers API for verifying rendered HTML using CSS, XPath,
> etc. "
>
> Thanks, Jarl
>

> --
> You received this message because you are subscribed to the Google Groups "webrat" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to webrat+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/webrat?hl=en.
>

cheers,
Matt

http://blog.mattwynne.net
+44(0)7974 430184

Jarl Friis

unread,
Sep 1, 2010, 4:24:02 AM9/1/10
to web...@googlegroups.com, Bryan Helmkamp
Matt Wynne <ma...@mattwynne.net> writes:

> #should isn't a webrat method, it's an RSpec method. You need to make sure RSpec is installed and the right rspec files are required (depending on what version you want to use). Ask on the rspec list for details.
>

Thanks, that makes sense. But the README could mention that this
feature is for RSpec users... and the 'cheat webrat' page does not
mention RSpec either...

I am not using RSpec (yet). But this is yet another reason to consider
RSpec...

Jarl

Matt Wynne

unread,
Sep 1, 2010, 4:28:53 AM9/1/10
to web...@googlegroups.com, Bryan Helmkamp

On 1 Sep 2010, at 09:24, Jarl Friis wrote:

> Matt Wynne <ma...@mattwynne.net> writes:
>
>> #should isn't a webrat method, it's an RSpec method. You need to make sure RSpec is installed and the right rspec files are required (depending on what version you want to use). Ask on the rspec list for details.
>>
>
> Thanks, that makes sense. But the README could mention that this
> feature is for RSpec users... and the 'cheat webrat' page does not
> mention RSpec either...

I'm sure Byran will happily accept a patch to the README that makes it easier to understand :)

>
> I am not using RSpec (yet). But this is yet another reason to consider
> RSpec...
>
> Jarl
>

Reply all
Reply to author
Forward
0 new messages