I have gone through the post of capybara + click on alert box but nothing seems to be work. Following is my scenario:
Scenario: When I click update
Updated answer here, since the options above seem to have all been deprecated.
Capybara::Session#accept_alert seems to be the best way to accomplish this now, where the action that will trigger the alert should be passed in a block. http://www.rubydoc.info/github/jnicklas/capybara/Capybara/Session:accept_alert
e.g.:
page.accept_alert 'Alert text here' do
click_button('Search')
end