title: Capybara and Rspec: correct way to use within() and have_selector() together?
body: <p>I use rspec 2.6.0 and Capybara 1.1.1 for acceptance testing.<br>
  With a view like the following: </p>
  
  <pre><code>&lt;tr &gt;
    &lt;td&gt;Team 3 Name&lt;/td&gt;
    &lt;td&gt;true&lt;/td&gt;
    &lt;td&gt;&lt;a href="/teams/3"&gt;Show&lt;/a&gt;&lt;/td&gt;
    &lt;td&gt;&lt;a href="/teams/3/edit"&gt;Edit&lt;/a&gt;&lt;/td&gt;
    &lt;td&gt;&lt;a href="/teams/3"&gt;Deactivate&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr &gt;
    &lt;td&gt;Team 4 Name&lt;/td&gt;
    &lt;td&gt;true&lt;/td&gt;
    &lt;td&gt;&lt;a href="/teams/4"&gt;Show&lt;/a&gt;&lt;/td&gt;
    &lt;td&gt;&lt;a href="/teams/4/edit"&gt;Edit&lt;/a&gt;&lt;/td&gt;
    &lt;td&gt;&lt;a href="/teams/4"&gt;Deactivate&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I want to write an acceptance test that states: "Team 3 does NOT have the 'Deactivate' link."  I expect the following to fail:</p>
  
  <pre><code>within('tr', :text =&gt; 'Team 3 Name') do |ref|
    page.should_not have_selector('a', :text =&gt; 'Deactivate')
  end
  </code></pre>
  
  <p>But it passes.  To further test what is going on, I wrote the absurd:  </p>
  
  <pre><code>lock = false
  within('tr', :text =&gt; 'Team 3 Name') do |ref|
    page.should have_selector('a', :text =&gt; 'Deactivate')
    page.should_not have_selector('a', :text =&gt; 'Deactivate')
    lock = true
  end
  lock.should be_true
  </code></pre>
  
  <p>Which passes as well.</p>
  
  <p>I am assuming from this that the scope the have_selector() call is using is not limited by the within() block, but I am not sure why this is.  The capybara documentation uses this pattern and does not seem to mention any gotchas.
  What is the correct way to use within to limit the scope of my select?
  Thank you. 
  /Salernost</p>