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
WIP - Added mocking to show_file_links_spec.rb integration test
Frank Bergmanne4faa9ef8bb6
diff --git a/modules/storages/spec/features/show_file_links_spec.rb b/modules/storages/spec/features/show_file_links_spec.rbindex ae2b692cc7b..2a6299ade6b 100644--- a/modules/storages/spec/features/show_file_links_spec.rb+++ b/modules/storages/spec/features/show_file_links_spec.rb@@ -41,9 +41,8 @@ describe 'Showing of file links in work package', with_flag: { storages_module_alet(:file_link) { create(:file_link, container: work_package, storage:) }let(:wp_page) { ::Pages::FullWorkPackage.new(work_package, project) }- # We're going to use the real ConnectionManager because we can't mock request_with_token_refresh- let(:connection_manager) { ::OAuthClients::ConnectionManager.new(user: current_user, oauth_client:) }- # let(:connection_manager) { instance_double(::OAuthClients::ConnectionManager) }+ let(:connection_manager) { instance_double(::OAuthClients::ConnectionManager) }+ let(:sync_service) { instance_double(::Storages::FileLinkSyncService) }before doallow(::OAuthClients::ConnectionManager)@@ -55,6 +54,16 @@ describe 'Showing of file links in work package', with_flag: { storages_module_aallow(connection_manager).to receive(:get_access_token).and_return(ServiceResult.success(result: oauth_client_token))+ allow(connection_manager)+ .to receive(:authorization_state)+ .and_return(:connected)++ # Mock FileLinkSyncService as if Nextcloud would respond with origin_permission=nil+ allow(::Storages::FileLinkSyncService)+ .to receive(:new).and_return(sync_service)+ allow(sync_service).to receive(:call) do |file_links|+ ServiceResult.success(result: file_links.each { |file_link| file_link.origin_permission = :view })+ endproject_storagefile_linkdiff --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.rbindex d0fa239239b..5cdf1881b5e 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@@ -84,7 +84,7 @@ describe 'API v3 file links resource', with_flag: { storages_module_active: trueallow(::Storages::FileLinkSyncService).to receive(:new).and_return(sync_service)allow(sync_service).to receive(:call) do |file_links|- ServiceResult.success(result: file_links)+ ServiceResult.success(result: file_links.each { |file_link| file_link.origin_permission = :view })endlogin_as current_user