私は初めてカピバラを試していて、自分のフォームを見つけるのに苦労していました. Rspec、Capybara、Rails 3.2.8、および Twitter Bootstrap を使用しています。
私のテストでは、次のことがありました。
before do
choose "Residential"
choose "Storage"
fill_in "Customer Location", with: 30082
fill_in "datepicker", with: 2012-12-02
fill_in "Email", with: "jesse@test.com"
fill_in "Phone", with: "555-555-5555"
end
そして、エラーが発生していました:
Failure/Error: choose "Residential"
Capybara::ElementNotFound:
cannot choose field, no radio button with id, name, or label 'Residential' found
私のフォームでは、(抜粋):
<%= quote.radio_button :customer_type, "Residential"%>
<%= quote.label "Residential", class:"radio inline" %>
サーバーを起動すると、フォームが表示され、フォーム要素に関連付けられた「Residential」という名前のラベルがあることが Firebug によって示されました。
問題を検索し、この投稿を見つけた後:カピバラがフォーム要素を見つけられない(とりわけ)、なぜそれが機能していないのかわかりませんでした。