title: How to test if an img tag points to an existing image?
body: <p>I'm using Cucumber and Capybara for BDD on a RoR application. I have the following feature</p>
  
  <pre><code>Feature: List profiles
    In order to know that the people behind the profiles are real people 
    As a lurker
    I want to be able to find who is registed and see their profile picture
  
  Background: Profiles have been added to the database, some with picture attached
    Given some profiles exist
    And  I am on the home page
  
  Scenario: Search by city, avatars should be there
    When I search for a city with profiles
    Then I should see some result profiles with avatar
  </code></pre>
  
  <p>The underlying Capybara steps file contains:</p>
  
  <pre><code>Then /^I should see some result profiles with avatar$/ do
    page.should have_css("#profile_search_results .profile img.avatar", :count =&gt; some_profiles)
  end
  </code></pre>
  
  <p>This step checks that the page contains</p>
  
  <pre><code>&lt;div id="#profile_search_results&gt;
    &lt;img class="avatar" src="" /&gt;
  </code></pre>
  
  <p>BUT... I also want to check if the image exists (it is not a broken image).</p>
  
  <p>How can I do this in my Capybara steps?</p>