title: rspec + capybara: expect(page) and page.within() cannot see loaded page?
body: <p>I'm using rspec 3.4.3 and capybara 2.7 in a feature-spec.</p>
  
  <p>when I run this test:</p>
  
  <pre><code> visit course_path( @course )
   expect(page).to have_content('short_title')
  </code></pre>
  
  <p>it turns red:</p>
  
  <pre><code> Failure/Error: expect(page).to have_content('short_title')
   Capybara::ElementNotFound:
     Unable to find xpath "/html"
  </code></pre>
  
  <p>when I change the test to </p>
  
  <pre><code> visit course_path( @course )
   within('body') do
     expect(page).to have_content('short_title')
   end
  </code></pre>
  
  <p>the test turns green, but as Thomas noted below, this is only because <code>within</code> is not doing any work.</p>
  
  <p>when I use</p>
  
  <pre><code> visit course_path( @course )
   page.within('body') do
     expect(page).to have_content('short_title')
   end 
  </code></pre>
  
  <p>it turns red again with</p>
  
  <pre><code> Capybara::ElementNotFound:
     Unable to find css "body"
  </code></pre>
  
  <p>If I output page.html just after the visit  I can see
  that the page is acutally there, has valid html and of course
  contains a body and the text. everything is visible, no 
  fancyfull javascript or css at all.</p>
  
  <p>what is happening here?</p>