diff options
author | Yorick Peterse <yorick@yorickpeterse.com> | 2019-09-05 18:38:19 +0200 |
---|---|---|
committer | Yorick Peterse <yorick@yorickpeterse.com> | 2019-09-05 18:38:19 +0200 |
commit | fa5c52217d57ac425e36ec26f1aec62e5af1992e (patch) | |
tree | a1ee3b4b9b046e9c01f53958ee9b92f9428b312a | |
parent | a76643ad2472d2765c24983ce37b301315d930f8 (diff) | |
download | gitlab-ce-fa5c52217d57ac425e36ec26f1aec62e5af1992e.tar.gz |
Fix global state in registrations_controller_specfix-captcha-spec-state
This spec would mess with global state used for captchas, but not reset
the state in all cases. This would then lead to the spec
spec/controllers/snippets_controller_spec.rb failing, but only on a fork
of gitlab-ee. To fix this we ensure the state is properly reset after
running the specs that change this state.
-rw-r--r-- | spec/controllers/registrations_controller_spec.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 35487682462..b79a1ac4810 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -83,6 +83,13 @@ describe RegistrationsController do stub_application_setting(recaptcha_enabled: true) end + after do + # Avoid test ordering issue and ensure `verify_recaptcha` returns true + unless Recaptcha.configuration.skip_verify_env.include?('test') + Recaptcha.configuration.skip_verify_env << 'test' + end + end + it 'displays an error when the reCAPTCHA is not solved' do fail_recaptcha @@ -93,11 +100,6 @@ describe RegistrationsController do end it 'redirects to the dashboard when the recaptcha is solved' do - # Avoid test ordering issue and ensure `verify_recaptcha` returns true - unless Recaptcha.configuration.skip_verify_env.include?('test') - Recaptcha.configuration.skip_verify_env << 'test' - end - post(:create, params: user_params) expect(flash[:notice]).to include 'Welcome! You have signed up successfully.' |