我正在爲使用webrat的rails應用程序編寫集成測試。填寫表格後,用戶按下提交併創建一個帳戶。Webrat和Rails:在click_button後使用assert_contain給我「你正在重定向」
click_button "Submit"
assert_contain "Your Account Has Been Created"
然而,該測試失敗:
expected the following element's content to include "Your Account Has Been Created":
You are being redirected.
<false> is not true.
通常遵循一個重定向我會用post_via_redirect,但只是看着Webrat的例子,click_button其次assert_contain應該工作
我只是開始使用Webrat,所以我在這裏錯過了一些明顯的東西?爲什麼我堅持使用重定向響應?
謝謝!
Deb
補丁完美的作品 – 2010-11-24 15:28:32
你也可以使用''follow_redirect有 – Rob 2010-12-03 16:40:11
......與此問題的不完全100%它不趕上'redirect_to的:back' – Rob 2010-12-03 17:39:56