Skip to content

Instantly share code, notes, and snippets.

@dalibor
Forked from joahking/confirm_dialog_steps.rb
Created March 4, 2011 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalibor/853897 to your computer and use it in GitHub Desktop.
Save dalibor/853897 to your computer and use it in GitHub Desktop.
Then /^(.+) and I confirm dialog box$/ do |step|
bypass_confirm_dialog
Then step
end
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
@javascript
Scenario: Lorem ipsum
...
When I press "Delete" and I confirm dialog box
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment