0

カピバラの代わりに使用できるものはありsave_and_open_pageますか? ユーザー登録フォームをテストするリクエスト仕様を作成しました。このテストが生成するはずのサインアップが成功すると、このテストはパスするはずですが、そうではありません。

しかしsave_and_open_page、最後に行うと、すべてのフォーム フィールドが空白になります。自分でデータ入力を行う開発環境でこれをミラーリングでき、すべてが成功するため、何が問題なのかを理解するのに苦労しています。明らかにこれは重要なテストであるため、これを手放すわけにはいきません。

私はTDDを少ししかやっていないので、このスタック(カピバラとポルターガイスト)に関するヒントやコツがあれば役に立ちます. 同じスタックを使用する他のリクエスト仕様で同様の問題は発生していません。

リクエストの仕様は次のとおりです。

it 'allows a user to subscribe', js: true do
  visit root_url
  click_link "Pricing"
  click_button "Subscribe", match: :first
  fill_in "First name", with: "Marky"
  fill_in "Last name", with: "Mark"
  fill_in "Company", with: "The Funky Bunch"
  fill_in "subscription_email", with: "marky.mark@thefunkybunch.com"
  fill_in "Password", with: "MyString"
  fill_in "Password confirmation", with: "MyString"
  fill_in "Credit Card Number", with: "4242424242424242"
  fill_in "Security Code on Card (CVV)", with: "123"
  select "July", from: "Card Expiration"
  select "2014", from: "card_year"
  check "chkACCEPT"
  click_button "Subscribe to myapp"
  # The line below fails, but a save_and_open page just shows a blank form
  current_path.should_not eq(new_subscription_path)
  page.should have_content("Thank You")
end
4

1 に答える 1