Forked from joahking/recaptcha_steps_with_method_definition.rb
Created
June 8, 2010 16:43
-
-
Save mattwynne/430284 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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