public

  • Download Gist
features/step_definitions/confirm_dialog_steps.rb
Ruby
1 2 3 4 5
Then /^(.+) and I confirm dialog box$/ do |step|
bypass_confirm_dialog
 
Then step
end
js_helpers.rb
Ruby
1 2 3 4 5 6 7 8
module JsHelpers
def bypass_confirm_dialog
# bypassing the confirm dialog
# http://groups.google.com/group/ruby-capybara/browse_thread/thread/89760b6fcab7fd19
# http://stackoverflow.com/questions/2458632/how-to-test-a-confirm-dialog-with-cucumber
page.evaluate_script('window.confirm = function() { return true; }')
end
end
some.feature
Cucumber
1 2 3 4
@javascript
Scenario: Lorem ipsum
...
When I press "Delete" and I confirm dialog box

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.