Rails / spec fill_in using placeholder

In my rspec test, how do I populate a text box using Placeholder. I cannot use id and name, as they are automatically generated for the nested form.

<input class="input-medium inline" id="user_kids_attributes_new_1342116887461_first_name" name="user[kids_attributes][new_1342116887461][first_name]" placeholder="First Name" size="30" type="text"> 

thanks

+8
rspec
source share
2 answers

Holder support will be in the next version of Capybara. For now, try:

 find("input[placeholder='First Name']").set "value" 
+6
source share

There is another way:

 fill_in :placeholder => "Fill in some text", :with => "Text" 
+6
source share

All Articles