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

Extend test. Reuse existing nextcloud_storage_configured factory.

Pavel Balashou8463a37ae563
diff --git a/modules/storages/spec/factories/storage_factory.rb b/modules/storages/spec/factories/storage_factory.rb
index d6e3a048059..7aab75d834b 100644
--- a/modules/storages/spec/factories/storage_factory.rb
+++ b/modules/storages/spec/factories/storage_factory.rb
@@ -37,10 +37,6 @@ FactoryBot.define do
oauth_client
end
- trait :with_oauth_application do
- oauth_application
- end
-
trait :as_generic do
provider_type { 'Storages::Storage' }
end
@@ -66,11 +62,6 @@ FactoryBot.define do
automatically_managed { false }
end
- trait :configured do
- with_oauth_application
- with_oauth_client
- end
-
trait :as_healthy do
health_status { 'healthy' }
health_reason { nil }
diff --git a/modules/storages/spec/workers/storages/manage_nextcloud_integration_cron_job_spec.rb b/modules/storages/spec/workers/storages/manage_nextcloud_integration_cron_job_spec.rb
index e953913e5a0..507e361a4ff 100644
--- a/modules/storages/spec/workers/storages/manage_nextcloud_integration_cron_job_spec.rb
+++ b/modules/storages/spec/workers/storages/manage_nextcloud_integration_cron_job_spec.rb
@@ -85,7 +85,7 @@ RSpec.describe Storages::ManageNextcloudIntegrationCronJob, :webmock, type: :job
subject { described_class.new.perform }
context 'when lock is free' do
- let(:storage1) { create(:nextcloud_storage, :as_automatically_managed, :configured) }
+ let(:storage1) { create(:nextcloud_storage_configured, :as_automatically_managed) }
it 'responds with true' do
expect(subject).to be(true)
@@ -93,6 +93,7 @@ RSpec.describe Storages::ManageNextcloudIntegrationCronJob, :webmock, type: :job
it 'calls GroupFolderPropertiesSyncService for each automatically managed storage' do
storage2 = create(:nextcloud_storage, :as_not_automatically_managed)
+ storage3 = create(:nextcloud_storage, :as_automatically_managed)
allow(Storages::NextcloudGroupFolderPropertiesSyncService)
.to receive(:call).with(storage1).and_return(ServiceResult.success)
@@ -101,6 +102,7 @@ RSpec.describe Storages::ManageNextcloudIntegrationCronJob, :webmock, type: :job
expect(Storages::NextcloudGroupFolderPropertiesSyncService).to have_received(:call).with(storage1).once
expect(Storages::NextcloudGroupFolderPropertiesSyncService).not_to have_received(:call).with(storage2)
+ expect(Storages::NextcloudGroupFolderPropertiesSyncService).not_to have_received(:call).with(storage3)
end
it 'marks storage as healthy if sync was successful' do