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 paths and cleaned up feature spec for ProjectStorage

Wieland Lindenthald7e4d02830ff
diff --git a/modules/storages/app/cells/storages/projects_storages_table_cell.rb b/modules/storages/app/cells/storages/projects_storages_table_cell.rb
index 197037cd234..50d144de15c 100644
--- a/modules/storages/app/cells/storages/projects_storages_table_cell.rb
+++ b/modules/storages/app/cells/storages/projects_storages_table_cell.rb
@@ -1,3 +1,31 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2022 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
module Storages
class ProjectsStoragesTableCell < ::TableCell
include ::IconsHelper
@@ -32,10 +60,10 @@ module Storages
def headers
[
- ['name', { caption: Storages::Storage.human_attribute_name(:name) }],
+ ['name', { caption: ::Storages::Storage.human_attribute_name(:name) }],
['provider_type', { caption: I18n.t('storages.provider_types.label') }],
['creator', { caption: I18n.t('storages.label_creator') }],
- ['created_at', { caption: Storages::ProjectStorage.human_attribute_name(:created_at) }]
+ ['created_at', { caption: ::Storages::ProjectStorage.human_attribute_name(:created_at) }]
]
end
end
diff --git a/modules/storages/app/contracts/storages/storages/base_contract.rb b/modules/storages/app/contracts/storages/storages/base_contract.rb
index 042040dc302..17cc4ea2624 100644
--- a/modules/storages/app/contracts/storages/storages/base_contract.rb
+++ b/modules/storages/app/contracts/storages/storages/base_contract.rb
@@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
-# Copyright (C) 2012-2021 the OpenProject GmbH
+# Copyright (C) 2012-2022 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
diff --git a/modules/storages/spec/features/create_and_delete_project_storage_spec.rb b/modules/storages/spec/features/create_and_delete_project_storage_spec.rb
index 94d6c6c3151..d3bae09db9a 100644
--- a/modules/storages/spec/features/create_and_delete_project_storage_spec.rb
+++ b/modules/storages/spec/features/create_and_delete_project_storage_spec.rb
@@ -30,10 +30,10 @@
require_relative '../spec_helper'
-# Setup a project storage within a project.
+# Setup storages within a project.
# This tests assumes that a Storage has already been setup
# in the Admin section, tested by admin_storage_spec.rb.
-describe 'Setup project storage', type: :feature, js: true do
+describe 'Activation of storages in projects', type: :feature, js: true do
let(:admin) { create(:admin) }
let(:storage) { create(:storage, name: "Storage 1") }
let(:project) do
@@ -49,28 +49,27 @@ describe 'Setup project storage', type: :feature, js: true do
login_as admin
end
- it 'activates up a ProjectStorage for a specific project' do
+ it 'adds and removes storages to projects' do
# Go to Projects -> Settings -> File Storages
visit project_settings_general_path(project)
page.find('.settings-projects-storages-menu-item').click
- # Check for an empty Project -> Settings -> File storages page
+ # Check for an empty table in Project -> Settings -> File storages
expect(page).to have_title('File storages')
expect(page).to have_current_path project_settings_projects_storages_path(project)
expect(page).to have_text('No storage setup, yet.')
page.find('.toolbar .button--icon.icon-add').click
- # Enable the one and only file storage
- expect(page).to have_title('File storages')
+ # Enable one file storage
+ expect(page).to have_current_path new_project_settings_projects_storage_path(project_id: project)
expect(page).to have_text('Enable a file storage')
page.find('button[type=submit]').click
# The list of enabled file storages should now contain Storage 1
- expect(page).to have_title('File storages')
expect(page).to have_text('File storages available in this project')
expect(page).to have_text('Storage 1')
- # Press Delete icon to disable the ProjectStorage again
+ # Press Delete icon to remove the storage from the project
page.find('.icon.icon-delete').click
alert_text = page.driver.browser.switch_to.alert.text
expect(alert_text).to have_text 'Are you sure'