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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Replace host string literal with storage.host.
Pavel Balashou0cee6d2363cf
diff --git a/modules/storages/spec/services/storages/group_folder_properties_sync_service_spec.rb b/modules/storages/spec/services/storages/group_folder_properties_sync_service_spec.rbindex c8f9aae5dfa..c4979df8c40 100644--- a/modules/storages/spec/services/storages/group_folder_properties_sync_service_spec.rb+++ b/modules/storages/spec/services/storages/group_folder_properties_sync_service_spec.rb@@ -374,7 +374,6 @@ RSpec.describe Storages::GroupFolderPropertiesSyncService, webmock: true dolet(:storage) docreate(:nextcloud_storage,:as_automatically_managed,- host: 'https://example.com',password: '12345678')endlet!(:project_storage1) do@@ -407,21 +406,21 @@ RSpec.describe Storages::GroupFolderPropertiesSyncService, webmock: true doorigin_user_id: 'Obi-Wan',user:,oauth_client:)- request_stubs << stub_request(:get, "https://example.com/ocs/v1.php/cloud/groups/#{storage.group}")+ request_stubs << stub_request(:get, "#{storage.host}/ocs/v1.php/cloud/groups/#{storage.group}").with(headers: {'Authorization' => 'Basic T3BlblByb2plY3Q6MTIzNDU2Nzg=','OCS-APIRequest' => 'true'}).to_return(status: 200, body: group_users_response_body, headers: {})- request_stubs << stub_request(:proppatch, "https://example.com/remote.php/dav/files/OpenProject/OpenProject")+ request_stubs << stub_request(:proppatch, "#{storage.host}/remote.php/dav/files/OpenProject/OpenProject").with(body: set_permissions_request_body1,headers: {'Authorization' => 'Basic T3BlblByb2plY3Q6MTIzNDU2Nzg='}).to_return(status: 207, body: set_permissions_response_body1, headers: {})- request_stubs << stub_request(:propfind, "https://example.com/remote.php/dav/files/OpenProject/OpenProject")+ request_stubs << stub_request(:propfind, "#{storage.host}/remote.php/dav/files/OpenProject/OpenProject").with(body: propfind_request_body,headers: {@@ -431,7 +430,7 @@ RSpec.describe Storages::GroupFolderPropertiesSyncService, webmock: true do).to_return(status: 207, body: propfind_response_body1, headers: {})request_stubs << stub_request(:mkcol,- "https://example.com/remote.php/dav/files/OpenProject/OpenProject/%5BSample%5D%20Project%20Name%20%7C%20Ehuu%20(#{project1.id})"+ "#{storage.host}/remote.php/dav/files/OpenProject/OpenProject/%5BSample%5D%20Project%20Name%20%7C%20Ehuu%20(#{project1.id})").with(headers: {'Authorization' => 'Basic T3BlblByb2plY3Q6MTIzNDU2Nzg='@@ -439,7 +438,7 @@ RSpec.describe Storages::GroupFolderPropertiesSyncService, webmock: true do).to_return(status: 201, body: "", headers: {})request_stubs << stub_request(:propfind,- "https://example.com/remote.php/dav/files/OpenProject/OpenProject/" \+ "#{storage.host}/remote.php/dav/files/OpenProject/OpenProject/" \"%5BSample%5D%20Project%20Name%20%7C%20Ehuu%20(#{project1.id})").with(body: propfind_request_body,@@ -448,7 +447,7 @@ RSpec.describe Storages::GroupFolderPropertiesSyncService, webmock: true do'Depth' => '1'}).to_return(status: 207, body: propfind_response_body2, headers: {})- request_stubs << stub_request(:post, "https://example.com/ocs/v1.php/cloud/users/Obi-Wan/groups")+ request_stubs << stub_request(:post, "#{storage.host}/ocs/v1.php/cloud/users/Obi-Wan/groups").with(body: "groupid=OpenProject",headers: {@@ -458,7 +457,7 @@ RSpec.describe Storages::GroupFolderPropertiesSyncService, webmock: true do).to_return(status: 200, body: add_user_to_group_response_body, headers: {})request_stubs << stub_request(:proppatch,- "https://example.com/remote.php/dav/files/OpenProject/OpenProject/" \+ "#{storage.host}/remote.php/dav/files/OpenProject/OpenProject/" \"%5BSample%5D%20Project%20Name%20%7C%20Ehuu%20(#{project1.id})").with(body: set_permissions_request_body2,@@ -468,7 +467,7 @@ RSpec.describe Storages::GroupFolderPropertiesSyncService, webmock: true do).to_return(status: 207, body: set_permissions_response_body2, headers: {})request_stubs << stub_request(:move,- "https://example.com/remote.php/dav/files/OpenProject/OpenProject/" \+ "#{storage.host}/remote.php/dav/files/OpenProject/OpenProject/" \"Lost%20Jedi%20Project%20Folder%20%233").with(headers: {@@ -479,7 +478,7 @@ RSpec.describe Storages::GroupFolderPropertiesSyncService, webmock: true do).to_return(status: 201, body: "", headers: {})request_stubs << stub_request(:proppatch,- "https://example.com/remote.php/dav/files/OpenProject/OpenProject/" \+ "#{storage.host}/remote.php/dav/files/OpenProject/OpenProject/" \"Jedi%20Project%20Folder%20%7C%7C%7C%20%28#{project2.id}%29").with(body: set_permissions_request_body2,@@ -489,7 +488,7 @@ RSpec.describe Storages::GroupFolderPropertiesSyncService, webmock: true do).to_return(status: 207, body: set_permissions_response_body4, headers: {})request_stubs << stub_request(:proppatch,- "https://example.com/remote.php/dav/files/OpenProject/OpenProject/" \+ "#{storage.host}/remote.php/dav/files/OpenProject/OpenProject/" \"NOT%20ACTIVE%20PROJECT").with(body: set_permissions_request_body5,@@ -499,7 +498,7 @@ RSpec.describe Storages::GroupFolderPropertiesSyncService, webmock: true do).to_return(status: 207, body: set_permissions_response_body5, headers: {})request_stubs << stub_request(:delete,- "https://example.com/ocs/v1.php/cloud/users/Darth%20Maul/groups?groupid=OpenProject"+ "#{storage.host}/ocs/v1.php/cloud/users/Darth%20Maul/groups?groupid=OpenProject").with(headers: {'Authorization' => 'Basic T3BlblByb2plY3Q6MTIzNDU2Nzg=',@@ -508,7 +507,7 @@ RSpec.describe Storages::GroupFolderPropertiesSyncService, webmock: true do).to_return(status: 200, body: remove_user_from_group_response, headers: {})request_stubs << stub_request(:proppatch,- "https://example.com/remote.php/dav/files/OpenProject/OpenProject/" \+ "#{storage.host}/remote.php/dav/files/OpenProject/OpenProject/" \"Lost%20Jedi%20Project%20Folder%20%232").with(body: set_permissions_request_body3,diff --git a/spec/services/projects/unarchive_service_spec.rb b/spec/services/projects/unarchive_service_spec.rbnew file mode 100644index 00000000000..08cdcf12123--- /dev/null+++ b/spec/services/projects/unarchive_service_spec.rb@@ -0,0 +1,50 @@+#-- 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.+#++++require 'spec_helper'++RSpec.describe Projects::UnarchiveService do+ let(:project) { create(:project, active: false) }+ let(:user) { create(:admin) }+ let(:instance) { described_class.new(user:, model: project) }++ it 'unarchives and sends the notification' do+ allow(OpenProject::Notifications).to receive(:send)+ expect(project.active).to be(false)++ expect(instance.call).to be_truthy++ expect(project.active).to be(true)+ expect(OpenProject::Notifications)+ .to(have_received(:send)+ .with(OpenProject::Events::PROJECT_UNARCHIVED, project:))+ expect(OpenProject::Notifications)+ .to(have_received(:send)+ .with(OpenProject::Events::PROJECT_UNARCHIVED, project:))+ end+end