Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Disable validation in test environment #19

Open
SideofClouds opened this issue Sep 1, 2014 · 1 comment
Open

Disable validation in test environment #19

SideofClouds opened this issue Sep 1, 2014 · 1 comment

Comments

@SideofClouds
Copy link

There should be an option to disable the validation entirely when testing (make it always return true) in the test environment or in the config file. I'm using Rspec.
For now in my controller specs i just use "controller.stub(:captcha_valid?).and_return(true)" but for some reason that doesn't work in my feature spec ... and I tried writing it in many ways:
allow(UserRegistrationController).to receive(:captcha_valid?).and_return true
UserRegistrationController.stub(:captcha_valid?).and_return(true)
... not working.
Some help would be greatly appreciated.
Thank you,
Dan

@SideofClouds
Copy link
Author

In the end I managed to bypass the validation in my feature spec using "UserRegistrationController.any_instance.stub(:captcha_valid?).and_return(true)" ... but the validation still needs to be disabled in the test environment by default so that there won't be a need to keep stubbing it.

TylerRick pushed a commit to TylerRick/easy_captcha that referenced this issue Jul 22, 2021
Add a class method for simpler validation
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant