0
私はajaxでフォームを送信します。フォームの送信時にエラーが発生すると、フォームはajax、jqueryを使用して再度レンダリングされます。CapybaraとAjaxテストが動作しない
は、「ボードの作成に失敗」を説明します:タイプ=>:私は次のようにカピバラとRSPECでこの動作をテストしようとしています
次のように要求を行うには、
it "should not create a birthday board" do
Capybara.default_wait_time = 5
lambda do
visit root_path
fill_in "Name", :with => ""
select('1967', :from => "board_birthday_1i")
select('October', :from => "board_birthday_2i")
select('30', :from => "board_birthday_3i")
click_button("Start the surprise")
page.should have_selector('div#error_explanation')
page.find_field('Name').value
end.should_not change(Board, :count)
end
end
結果は以下のとおりです。
Failure/Error: page.should have_selector('div#error_explanation')
expected following output to contain a <div#error_explanation/> tag:
私は実際にページにerror_explanation divを持っています。
このテストはなぜ失敗しますか?
ありがとうございます。
どこかにjs => trueオプションを追加していますので、ajaxが実行されますか? – grzuy
私は、私の宝石ファイルにカピバラと私共の両方を持っています。私は、問題を引き起こしている私とカピバラの間に葛藤があると思う – chell