I’m under capybara and rspec, which is the best way to test the destroy link for an object?
I have to click this link
<a href="/categories/1" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a>
but I’m not able to select it with:
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
any hint?
Thank you!
1 Answer