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

fix: Update `HTTPX.get` mocks to `OpenProject.httpx.get`

Kabiru Mwenja607338bdc0e7
diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/file_info_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/file_info_query_spec.rb
index ae782aef455..66cc2f726e7 100644
--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/file_info_query_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/file_info_query_spec.rb
@@ -192,7 +192,9 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FileInfoQuer
before do
request = HTTPX::Request.new(:get, 'https://my.timeout.org/')
- allow(HTTPX).to receive(:get).and_return(HTTPX::ErrorResponse.new(request, 'Timeout happens', {}))
+ httpx_double = class_double(HTTPX, get: HTTPX::ErrorResponse.new(request, 'Timeout happens', {}))
+
+ allow(OpenProject).to receive(:httpx).and_return(httpx_double)
end
it 'must return an error with wrapped network error response' do
diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_info_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_info_query_spec.rb
index 5ef8633bd27..c53f589180e 100644
--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_info_query_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_info_query_spec.rb
@@ -220,7 +220,9 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesInfoQue
before do
request = HTTPX::Request.new(:get, 'https://my.timeout.org/')
- allow(HTTPX).to receive(:get).and_return(HTTPX::ErrorResponse.new(request, 'Timeout happens', {}))
+ httpx_double = class_double(HTTPX, get: HTTPX::ErrorResponse.new(request, 'Timeout happens', {}))
+
+ allow(OpenProject).to receive(:httpx).and_return(httpx_double)
end
it 'must return an array of file information when called' do
diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb
index 5f83796ee8e..71e71bf0880 100644
--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb
@@ -242,7 +242,9 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery,
context 'with network errors' do
before do
request = HTTPX::Request.new(:get, 'https://my.timeout.org/')
- allow(HTTPX).to receive(:get).and_return(HTTPX::ErrorResponse.new(request, 'Timeout happens', {}))
+ httpx_double = class_double(HTTPX, get: HTTPX::ErrorResponse.new(request, 'Timeout happens', {}))
+
+ allow(OpenProject).to receive(:httpx).and_return(httpx_double)
end
it 'must return an error with wrapped network error response' do
diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_storage_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_storage_query_spec.rb
index 44e54762780..7ee646a596a 100644
--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_storage_query_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_storage_query_spec.rb
@@ -93,7 +93,9 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::OpenStorageQ
context 'with network errors' do
before do
request = HTTPX::Request.new(:get, 'https://my.timeout.org/')
- allow(HTTPX).to receive(:get).and_return(HTTPX::ErrorResponse.new(request, 'Timeout happens', {}))
+ httpx_double = class_double(HTTPX, get: HTTPX::ErrorResponse.new(request, 'Timeout happens', {}))
+
+ allow(OpenProject).to receive(:httpx).and_return(httpx_double)
end
it 'must return an error with wrapped network error response' do