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
Started to fix show_file_links_spec.rb, but not finished yet...
Frank Bergmannd6242cab8439
diff --git a/modules/storages/lib/api/v3/file_links/work_packages_file_links_api.rb b/modules/storages/lib/api/v3/file_links/work_packages_file_links_api.rbindex fdebbdc83f6..fe2796d575a 100644--- a/modules/storages/lib/api/v3/file_links/work_packages_file_links_api.rb+++ b/modules/storages/lib/api/v3/file_links/work_packages_file_links_api.rb@@ -58,8 +58,7 @@ module APIraise ::API::Errors::InvalidQuery.new(message)end- # Get the list of all FileLinks for the work package.- # This could be a huge array in some cases...+ # Get a (potentially huge...) list of all FileLinks for the work package.file_links = query.results.where(id: visible_file_links_scope@@ -67,7 +66,7 @@ module API.allbegin- # Synchronize with Nextcloud. StorageAPI handles OAuth2 for us.+ # Synchronize with Nextcloud. StorageAPI has handled OAuth2 for us before.# We ignore the result, because partial errors (storage network issues) are written to each FileLinkservice_result = ::Storages::FileLinkSyncService.new(user: current_user)diff --git a/modules/storages/spec/features/show_file_links_spec.rb b/modules/storages/spec/features/show_file_links_spec.rbindex f4796170d6f..c7812eeb2a8 100644--- a/modules/storages/spec/features/show_file_links_spec.rb+++ b/modules/storages/spec/features/show_file_links_spec.rb@@ -29,21 +29,33 @@require_relative '../spec_helper'describe 'Showing of file links in work package', with_flag: { storages_module_active: true }, type: :feature, js: true do- let(:permissions) { %i(view_work_packages edit_work_packages view_file_links) }+ let(:permissions) { %i(view_work_packages edit_work_packages view_file_links manage_file_links) }let(:project) { create(:project) }- let(:current_user) do- create(:user, member_in_project: project, member_with_permissions: permissions)- end+ let(:current_user) { create(:user, member_in_project: project, member_with_permissions: permissions) }let(:work_package) { create(:work_package, project:, description: 'Initial description') }+let(:storage) { create(:storage) }+ let(:oauth_client) { create(:oauth_client, integration: storage) }+ let(:oauth_client_token) { create(:oauth_client_token, oauth_client:, user: current_user) }let(:project_storage) { create(:project_storage, project:, storage:) }let(:file_link) { create(:file_link, container: work_package, storage:) }let(:wp_page) { ::Pages::FullWorkPackage.new(work_package, project) }- let(:connection_manager) { instance_double(::OAuthClients::ConnectionManager) }++ # 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: oauth_client) }+ # let(:connection_manager) { instance_double(::OAuthClients::ConnectionManager) }before do- allow(connection_manager).to receive(:authorization_state).and_return(:connected)- allow(::OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)+ allow(::OAuthClients::ConnectionManager)+ .to receive(:new)+ .and_return(connection_manager)+ allow(connection_manager)+ .to receive(:refresh_token)+ .and_return(ServiceResult.success(result: oauth_client_token))+ allow(connection_manager)+ .to receive(:get_access_token)+ .and_return(ServiceResult.success(result: oauth_client_token))+project_storagefile_link