提交 95737ab1 编写于 作者: S Stan Hu

Fix order-dependent spec failures with reCAPTCHA

spec/controllers/registrations_controller_spec.rb polluted the test
environment by changing the Recaptcha configuration. We now stub the
controller's `verify_recaptcha` method instead of doing that.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/67133
上级 222d9e62
......@@ -74,17 +74,12 @@ describe RegistrationsController do
end
context 'when reCAPTCHA is enabled' do
def fail_recaptcha
# Without this, `verify_recaptcha` arbitrarily returns true in test env
Recaptcha.configuration.skip_verify_env.delete('test')
end
before do
stub_application_setting(recaptcha_enabled: true)
end
it 'displays an error when the reCAPTCHA is not solved' do
fail_recaptcha
allow_any_instance_of(described_class).to receive(:verify_recaptcha).and_return(false)
post(:create, params: user_params)
......@@ -105,7 +100,6 @@ describe RegistrationsController do
it 'does not require reCAPTCHA if disabled by feature flag' do
stub_feature_flags(registrations_recaptcha: false)
fail_recaptcha
post(:create, params: user_params)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册