这是一段使用水豚进行 Rails 集成测试的代码:
it "should work with links on index page" do
visit customers_path
save_and_open_page
click_link 'Edit'
end
显示的html页面是:
页面中有一个编辑链接。但是 click_link 'Edit' 仍然抛出错误:
1) TestPaths GET /customerx_test_paths should work with links on index page
←[31mFailure/Error:←[0m ←[31mclick_link 'Edit'←[0m
←[31mCapybara::InfiniteRedirectError:←[0m
←[31mredirected more than 5 times, check for infinite redirects.←[0m
←[36m # ./spec/features/customerx/customerx_test_paths_spec.rb:130:in `block (3 levels) in <top (required)>'←[0m
编辑客户通过的集成测试。但是测试中的每个 click_link 都会给我们带来错误。代码可能有什么问题?谢谢。