[rspec-users] nokogiri selector help

Jonathan Linowes jonathan at parkerhill.com
Sat Jan 24 00:05:40 EST 2009


hiya,

i want the selector that would return a <tr> of a table if any td  
contains some text, so i can use it in click_link_within

e.g. When I click the "show" link within the row containing  
"user at example.com"


When /^I click the "(.+)" link within the row containing "(.+)"$/ do | 
link, text|
	selector = ??
	click_link_within  selector, link
end


-----------
and lets say the response contains

...
<div class="table-container">
   <table>
     <tbody>
       <tr>...</tr>
       <tr>
         <td><a href="/posts/14">show</a></td>
         <td>foo</td>
         <td>bar</td>
         <td>user at example.com</td>
         <td>baz</td>
       </tr>
       <tr>...</tr>
     </tbody>
   </table>
</div>
...




More information about the rspec-users mailing list