Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mattwynne/430284 to your computer and use it in GitHub Desktop.
Save mattwynne/430284 to your computer and use it in GitHub Desktop.
When /^I fill the captcha incorrectly$/ do
captcha_evaluates_to false
end
When /^I fill the captcha correctly$/ do
captcha_evaluates_to true
end
module ShortCircuit
attr_accessor :short_circuit_to
def verify_recaptcha
return short_circuit_to if short_circuit_to
super
end
end
Recaptcha::Verify.extend(ShortCircuit)
After do
# clear out the short-circuit value
Recaptcha::Verify.short_cicruit_to(nil)
end
def captcha_evaluates_to(result)
Recaptcha::Verify.short_circuit_to(result)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment