Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Correctly stub self-registration in spec

Oliver Günthercd9312120cc6
diff --git a/spec/controllers/concerns/omniauth_login_spec.rb b/spec/controllers/concerns/omniauth_login_spec.rb
index c75b9da00b6..6ba7b6090de 100644
--- a/spec/controllers/concerns/omniauth_login_spec.rb
+++ b/spec/controllers/concerns/omniauth_login_spec.rb
@@ -243,7 +243,8 @@ describe AccountController, type: :controller do
end
end
- context 'with self-registration disabled' do
+ context 'with self-registration disabled',
+ with_settings: { self_registration: 0 } do
let(:omniauth_hash) do
OmniAuth::AuthHash.new(
provider: 'google',
@@ -257,8 +258,6 @@ describe AccountController, type: :controller do
end
before do
- allow(Setting).to receive(:self_registration?).and_return(false)
-
request.env['omniauth.auth'] = omniauth_hash
request.env['omniauth.origin'] = 'https://example.net/some_back_url'