我在水豚和rspec下,這是測試對象的銷燬鏈接的最佳方式? 我必須點擊此鏈接用水豚和rspec測試破壞行爲
<a href="/categories/1" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a>
,但我不能與選擇它:
it "should destroy a category" do
visit categories_path
find(:xpath, '//link[@href="/categories/1"]').click
# how to handle javascript pop up for confirmation?
end
任何暗示? 謝謝!