In Capybara + Webkit + Ruby 1.9.3, I have the following HTML
simple_form generates the following when there's an error on a specific field. I'm having trouble "getting at" the error-text span and knowing I definitely have the one associated with "Title" rather than another field that may also have an error.
<div class="input-wrapper string required error">
<div class="input-label">
<label class="string required" for="event_title">
<abbr title="required">*</abbr>
Title
</label>
<span class="error-text">can't be blank</span>
<input id="event_title" class="string required" type="text" value="" size="50" name="event[title]">
</div>
(plus many other fields, of course!)
I want to test that Title is, in fact required and when the user leaves blank and clicks the submit button, the error message "can't be blank" exists. Short of tweaking simple_form to wrap around the whole thing, is there a way to simply find the label and then go to next element in the DOM to see if its a span with "can't be blank" content?