title: Rails and Rspec - checking for existence of errors when form submission fails
body: <p>I have a Foo model, where <strong>:name</strong> is required on creation.</p>
  
  <p>I'm writing a spec to test the validations</p>
  
  <pre><code>it 'should not create an invalid Foo' do
    fill_in "Name", :with=&gt;""
    # an error message will be displayed when this button is clicked
    click_button "Create Foo"
  end
  </code></pre>
  
  <p><strong>How can I confirm that the error message is present on the page?</strong></p>
  
  <p>I've tried <code>page.errors.should have_key(:name)</code> but this is not right. </p>
  
  <p>I guess I could do <code>page.should have_content("Name can't be blank")</code> but I'd prefer to avoid coupling my integration tests so strongly with the content</p>