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

Rewrite spec to not stub settings when overridden

Oliver Günther88a866c071c6
diff --git a/modules/openid_connect/spec/controllers/providers_controller_spec.rb b/modules/openid_connect/spec/controllers/providers_controller_spec.rb
index fefd1a4edf4..26cd3e12e14 100644
--- a/modules/openid_connect/spec/controllers/providers_controller_spec.rb
+++ b/modules/openid_connect/spec/controllers/providers_controller_spec.rb
@@ -204,11 +204,13 @@ describe OpenIDConnect::ProvidersController do
end
describe '#update' do
- context 'when found', with_settings: {
- plugin_openproject_openid_connect: {
- "providers" => { "azure" => { "identifier" => "IDENTIFIER", "secret" => "SECRET" } }
- }
- } do
+ context 'when found' do
+ before do
+ Setting.plugin_openproject_openid_connect = {
+ "providers" => { "azure" => { "identifier" => "IDENTIFIER", "secret" => "SECRET" } }
+ }
+ end
+
it 'successfully updates the provider configuration' do
put :update, params: { id: "azure", openid_connect_provider: valid_params.merge(secret: "NEWSECRET") }
expect(response).to be_redirect
@@ -220,11 +222,13 @@ describe OpenIDConnect::ProvidersController do
end
describe '#destroy' do
- context 'when found', with_settings: {
- plugin_openproject_openid_connect: {
- "providers" => { "azure" => { "identifier" => "IDENTIFIER", "secret" => "SECRET" } }
- }
- } do
+ context 'when found' do
+ before do
+ Setting.plugin_openproject_openid_connect = {
+ "providers" => { "azure" => { "identifier" => "IDENTIFIER", "secret" => "SECRET" } }
+ }
+ end
+
it 'removes the provider' do
delete :destroy, params: { id: "azure" }
expect(response).to be_redirect