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

Remove the default admin shared context as it is not necessary.

Dombi Attila9fbe0729b829
diff --git a/modules/backlogs/spec/features/tasks_on_taskboard_spec.rb b/modules/backlogs/spec/features/tasks_on_taskboard_spec.rb
index 15015a33937..1215c6741af 100644
--- a/modules/backlogs/spec/features/tasks_on_taskboard_spec.rb
+++ b/modules/backlogs/spec/features/tasks_on_taskboard_spec.rb
@@ -32,7 +32,6 @@ require_relative '../support/pages/taskboard'
RSpec.describe 'Tasks on taskboard',
js: true,
with_cuprite: false do
- include_context 'with default admin'
let!(:project) do
create(:project,
types: [story, task, other_story],
diff --git a/spec/controllers/my_controller_spec.rb b/spec/controllers/my_controller_spec.rb
index 29bd1967d50..572c2305ae7 100644
--- a/spec/controllers/my_controller_spec.rb
+++ b/spec/controllers/my_controller_spec.rb
@@ -29,8 +29,6 @@
require 'spec_helper'
RSpec.describe MyController do
- include_context 'with default admin'
-
let(:user) { create(:user) }
before do
diff --git a/spec/features/users/my_spec.rb b/spec/features/users/my_spec.rb
index 24abb694ff3..13e26cde3bb 100644
--- a/spec/features/users/my_spec.rb
+++ b/spec/features/users/my_spec.rb
@@ -29,7 +29,6 @@
require 'spec_helper'
RSpec.describe 'my', js: true, with_cuprite: true do
- include_context 'with default admin'
let(:user_password) { 'bob' * 4 }
let(:user) do
create(:user,
diff --git a/spec/requests/api/v3/user/update_form_resource_spec.rb b/spec/requests/api/v3/user/update_form_resource_spec.rb
index 0871872fdf7..856c5906029 100644
--- a/spec/requests/api/v3/user/update_form_resource_spec.rb
+++ b/spec/requests/api/v3/user/update_form_resource_spec.rb
@@ -32,8 +32,6 @@ RSpec.describe API::V3::Users::UpdateFormAPI, content_type: :json do
include Rack::Test::Methods
include API::V3::Utilities::PathHelper
- include_context 'with default admin'
-
shared_let(:text_custom_field) do
create(:user_custom_field, :string)
end
@@ -61,6 +59,8 @@ RSpec.describe API::V3::Users::UpdateFormAPI, content_type: :json do
subject(:response) { last_response }
context 'with authorized user' do
+ # Required to satisfy the Users::UpdateContract#at_least_one_admin_is_active
+ shared_let(:default_admin) { create(:admin) }
shared_let(:current_user) do
create(:user, global_permissions: [:manage_user])
end
diff --git a/spec/requests/api/v3/user/update_user_resource_spec.rb b/spec/requests/api/v3/user/update_user_resource_spec.rb
index 6354778b017..e88900433a7 100644
--- a/spec/requests/api/v3/user/update_user_resource_spec.rb
+++ b/spec/requests/api/v3/user/update_user_resource_spec.rb
@@ -30,7 +30,6 @@ require 'rack/test'
RSpec.describe API::V3::Users::UsersAPI do
include API::V3::Utilities::PathHelper
- include_context 'with default admin'
let(:path) { api_v3_paths.user(user.id) }
let(:user) { create(:user) }
diff --git a/spec/services/authentication/omniauth_service_spec.rb b/spec/services/authentication/omniauth_service_spec.rb
index a4b3fa31c0d..6242137ef2d 100644
--- a/spec/services/authentication/omniauth_service_spec.rb
+++ b/spec/services/authentication/omniauth_service_spec.rb
@@ -28,8 +28,6 @@
require 'spec_helper'
RSpec.describe Authentication::OmniauthService do
- include_context 'with default admin'
-
let(:strategy) { double('Omniauth Strategy', name: 'saml') }
let(:auth_hash) do
OmniAuth::AuthHash.new(
diff --git a/spec/services/ldap/synchronize_users_service_integration_spec.rb b/spec/services/ldap/synchronize_users_service_integration_spec.rb
index 6535e134742..8c64e4ace88 100644
--- a/spec/services/ldap/synchronize_users_service_integration_spec.rb
+++ b/spec/services/ldap/synchronize_users_service_integration_spec.rb
@@ -2,7 +2,6 @@ require 'spec_helper'
RSpec.describe Ldap::SynchronizeUsersService do
include_context 'with temporary LDAP'
- include_context 'with default admin'
subject do
described_class.new(ldap_auth_source).call
diff --git a/spec/services/users/set_attributes_service_integration_spec.rb b/spec/services/users/set_attributes_service_integration_spec.rb
index ce8b47b7977..74d84f47ca1 100644
--- a/spec/services/users/set_attributes_service_integration_spec.rb
+++ b/spec/services/users/set_attributes_service_integration_spec.rb
@@ -29,8 +29,6 @@
require 'spec_helper'
RSpec.describe Users::SetAttributesService, 'Integration', type: :model do
- include_context 'with default admin'
-
shared_let(:input_user) { create(:user) }
let(:actor) { build_stubbed(:admin) }
diff --git a/spec/services/users/update_service_spec.rb b/spec/services/users/update_service_spec.rb
index 7280211efd7..04443b3eb55 100644
--- a/spec/services/users/update_service_spec.rb
+++ b/spec/services/users/update_service_spec.rb
@@ -29,8 +29,6 @@ require 'spec_helper'
require 'services/base_services/behaves_like_update_service'
RSpec.describe Users::UpdateService do
- include_context 'with default admin'
-
it_behaves_like 'BaseServices update service' do
# The user service also tries to save the preferences
before do
@@ -40,7 +38,7 @@ RSpec.describe Users::UpdateService do
describe 'updating attributes' do
let(:instance) { described_class.new(model: update_user, user: current_user) }
- let(:current_user) { build_stubbed(:admin) }
+ let(:current_user) { create(:admin) }
let(:update_user) { create(:user, mail: '[email protected]') }
subject { instance.call(attributes:) }
diff --git a/spec/support/shared/with_default_admin.rb b/spec/support/shared/with_default_admin.rb
deleted file mode 100644
index 0cb2cd0fded..00000000000
--- a/spec/support/shared/with_default_admin.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2023 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-
-RSpec.shared_context 'with default admin' do
- shared_let(:default_admin) { create(:admin) }
-end