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

[56045] Added component spec for GeneralInfoComponent in storages

Andreas Pfohlb49706236972
diff --git a/modules/storages/app/components/storages/admin/general_info_component.rb b/modules/storages/app/components/storages/admin/general_info_component.rb
index 292faab9133..4fcf0d8ff4e 100644
--- a/modules/storages/app/components/storages/admin/general_info_component.rb
+++ b/modules/storages/app/components/storages/admin/general_info_component.rb
@@ -39,15 +39,15 @@ module Storages::Admin
def self.wrapper_key = :storage_general_info_section
def initialize(model = nil, **options)
- super
-
auth_strategy = ::Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken
.strategy
.with_user(User.current)
@href_result = ::Storages::Peripherals::Registry
- .resolve("#{storage.short_provider_type}.queries.open_storage")
- .call(storage:, auth_strategy:)
+ .resolve("#{model.short_provider_type}.queries.open_storage")
+ .call(storage: model, auth_strategy:)
+
+ super
end
def open_link_was_generated
diff --git a/modules/storages/spec/components/storages/admin/general_info_component_spec.rb b/modules/storages/spec/components/storages/admin/general_info_component_spec.rb
new file mode 100644
index 00000000000..b54d4bb97a8
--- /dev/null
+++ b/modules/storages/spec/components/storages/admin/general_info_component_spec.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 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.
+#++
+
+require "spec_helper"
+require_module_spec_helper
+
+RSpec.describe Storages::Admin::GeneralInfoComponent, type: :component do
+ describe "#description" do
+ context "with storage configured" do
+ it "must show a link to the storage" do
+ storage = create(:nextcloud_storage)
+ component = described_class.new(storage)
+ expect(component.open_link_was_generated).to be_truthy
+ expect(component.open_href).not_to be_nil
+ end
+ end
+ end
+end