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

Fixed storages specs

Andreas Pfohl663cb7f84ae8
diff --git a/modules/storages/app/common/storages/peripherals/storage_url_helper.rb b/modules/storages/app/common/storages/peripherals/storage_url_helper.rb
index 5bf507611ff..a92752851d7 100644
--- a/modules/storages/app/common/storages/peripherals/storage_url_helper.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_url_helper.rb
@@ -73,7 +73,7 @@ module Storages::Peripherals
end
def make_direct_download(storage:, access_token:, file_id:)
- response = API::V3::Utilities::StorageRequests
+ response = Storages::Peripherals::StorageRequests
.new(storage:)
.download_command
.call(access_token:, file_id:)
diff --git a/modules/storages/lib/api/v3/file_links/create_endpoint.rb b/modules/storages/lib/api/v3/file_links/create_endpoint.rb
index 11bfe5e24d6..e9900b2d23c 100644
--- a/modules/storages/lib/api/v3/file_links/create_endpoint.rb
+++ b/modules/storages/lib/api/v3/file_links/create_endpoint.rb
@@ -30,7 +30,7 @@
# in modules/storages/lib/api/v3/file_links/work_packages_file_links_api.rb
#
# Multiple classes are involved during its lifecycle:
-# - API::V3::Utilities::ParseCreateParamsService
+# - Storages::Peripherals::ParseCreateParamsService
# - API::V3::FileLinks::FileLinkCollectionRepresenter
# - Storages::FileLinks::CreateService
#
diff --git a/modules/storages/spec/lib/api/v3/utilities/storage_requests_spec.rb b/modules/storages/spec/common/peripherals/storage_requests_spec.rb
similarity index 98%
rename from modules/storages/spec/lib/api/v3/utilities/storage_requests_spec.rb
rename to modules/storages/spec/common/peripherals/storage_requests_spec.rb
index 03f1ad8d88e..86f280083e1 100644
--- a/modules/storages/spec/lib/api/v3/utilities/storage_requests_spec.rb
+++ b/modules/storages/spec/common/peripherals/storage_requests_spec.rb
@@ -28,7 +28,9 @@
require 'spec_helper'
-describe API::V3::Utilities::StorageRequests, webmock: true do
+describe Storages::Peripherals::StorageRequests, webmock: true do
+ using Storages::Peripherals::ServiceResultRefinements
+
let(:user) { build_stubbed(:user) }
let(:url) { 'https://example.com' }
diff --git a/modules/storages/spec/requests/api/v3/file_links/file_links_spec.rb b/modules/storages/spec/requests/api/v3/file_links/file_links_spec.rb
index 1e195581c81..568c1931677 100644
--- a/modules/storages/spec/requests/api/v3/file_links/file_links_spec.rb
+++ b/modules/storages/spec/requests/api/v3/file_links/file_links_spec.rb
@@ -359,8 +359,8 @@ describe 'API v3 file links resource', type: :request do
actual: 'Integer')
end
- context "when more than #{API::V3::Utilities::ParseCreateParamsService::MAX_ELEMENTS} embedded elements" do
- let(:max) { API::V3::Utilities::ParseCreateParamsService::MAX_ELEMENTS }
+ context "when more than #{Storages::Peripherals::ParseCreateParamsService::MAX_ELEMENTS} embedded elements" do
+ let(:max) { Storages::Peripherals::ParseCreateParamsService::MAX_ELEMENTS }
let(:too_many) { max + 1 }
let(:embedded_elements) { build_list(:file_link_element, too_many, storage_url: storage_url1) }
@@ -473,7 +473,7 @@ describe 'API v3 file links resource', type: :request do
describe 'GET /api/v3/file_links/:file_link_id/download' do
let(:connection_manager) { instance_double(::OAuthClients::ConnectionManager) }
- let(:request_factory) { instance_double(::API::V3::Utilities::StorageRequests) }
+ let(:request_factory) { instance_double(Storages::Peripherals::StorageRequests) }
let(:access_token_result) { ServiceResult.success(result: create(:oauth_client_token)) }
let(:path) { api_v3_paths.file_link_download(file_link.id) }
let(:download_response) { instance_double(RestClient::Response) }
@@ -484,7 +484,7 @@ describe 'API v3 file links resource', type: :request do
allow(connection_manager).to receive(:get_access_token).and_return(access_token_result)
allow(::OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)
allow(request_factory).to receive(:download_command).and_return(->(*) { download_command_result })
- allow(::API::V3::Utilities::StorageRequests).to receive(:new).and_return(request_factory)
+ allow(Storages::Peripherals::StorageRequests).to receive(:new).and_return(request_factory)
allow(download_response).to receive(:body).and_return(response_body)
get path