Looping through all matching css selectors

3 views
Skip to first unread message

Karl Baum

unread,
Oct 18, 2009, 9:09:51 PM10/18/09
to web...@googlegroups.com
Is there a way to loop through all matching css selectors within webrat?

thx

Karl Baum

unread,
Oct 18, 2009, 9:24:03 PM10/18/09
to web...@googlegroups.com
Was able to get this done by using a mixture of nokogiri and webrat syntax.  The following loops thorugh some delayed job rows in a typus html table and checks that each job has not had any retries.

Then /^the delayed jobs should all have 0 attempts$/ do
  doc = Nokogiri::HTML(response.body)
  doc.css('.delayed_job').each do |html|
    html.should have_selector(".attempts", :content=>'0')
  end
end



On 10/18/09 9:09 PM, "Karl Baum" <karl...@gmail.com> wrote:

Matt Wynne

unread,
Oct 19, 2009, 3:53:51 AM10/19/09
to web...@googlegroups.com

On 19 Oct 2009, at 02:24, Karl Baum wrote:

> Was able to get this done by using a mixture of nokogiri and webrat
> syntax. The following loops thorugh some delayed job rows in a
> typus html table and checks that each job has not had any retries.
>
> Then /^the delayed jobs should all have 0 attempts$/ do
> doc = Nokogiri::HTML(response.body)

I think you can call something like #current_dom to get this (don't
have code in front of me so that might not be quite correct)

> doc.css('.delayed_job').each do |html|
> html.should have_selector(".attempts", :content=>'0')
> end
> end
>
>
> On 10/18/09 9:09 PM, "Karl Baum" <karl...@gmail.com> wrote:
>
>> Is there a way to loop through all matching css selectors within
>> webrat?
>>
>> thx
>
> >

cheers,
Matt

+447974 430184
ma...@mattwynne.net
http://mattwynne.net

Reply all
Reply to author
Forward
0 new messages