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
replace legacy spec
ulfertse1064e9fb24b
diff --git a/spec/lib/redmine/menu_manager_spec.rb b/spec/lib/redmine/menu_manager_spec.rbnew file mode 100644index 00000000000..cca95581270--- /dev/null+++ b/spec/lib/redmine/menu_manager_spec.rb@@ -0,0 +1,86 @@+# OpenProject is an open source project management software.+# Copyright (C) 2010-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.++require 'spec_helper'++describe Redmine::MenuManager do+ describe '.items' do+ context 'for the top_menu' do+ it 'includes the expected items' do+ expect(described_class.items(:top_menu).map(&:name))+ .to include(:work_packages, :news, :help)+ end+ end++ context 'for the account_menu' do+ it 'includes the expected items' do+ expect(described_class.items(:account_menu).map(&:name))+ .to include(:administration, :my_account, :my_page, :logout)+ end+ end++ context 'for the project_menu' do+ it 'includes the expected items' do+ expect(described_class.items(:project_menu).map(&:name))+ .to include(:overview, :activity, :roadmap, :work_packages, :news, :forums, :repository, :settings)+ end+ end++ context 'for the application_menu' do+ it 'includes the expected items' do+ expect(described_class.items(:application_menu).map(&:name))+ .to include(:work_packages_query_select)+ end+ end++ context 'for the notifications_menu' do+ it 'includes the expected items' do+ expect(described_class.items(:notifications_menu).map(&:name))+ .to include(:notification_grouping_select)+ end+ end++ context 'for the my_menu' do+ it 'includes the expected items' do+ expect(described_class.items(:my_menu).map(&:name))+ .to include(:account, :settings, :password, :access_token, :notifications, :reminders, :delete_account)+ end+ end++ context 'for the admin_menu' do+ it 'includes the expected items' do+ expect(described_class.items(:admin_menu).map(&:name))+ .to include(:admin_overview,+ :users,+ :placeholder_users,+ :groups,+ :custom_fields,+ :authentication,+ :announcements)+ end+ end+ end+enddiff --git a/spec_legacy/unit/lib/redmine_spec.rb b/spec_legacy/unit/lib/redmine_spec.rbdeleted file mode 100644index 3cb5d8f75dc..00000000000--- a/spec_legacy/unit/lib/redmine_spec.rb+++ /dev/null@@ -1,85 +0,0 @@-#-- 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.-#++-require_relative '../../legacy_spec_helper'--module RedmineMenuTestHelper- # Assertions- def assert_number_of_items_in_menu(menu_name, count)- assert Redmine::MenuManager.items(menu_name).size >= count, "Menu has less than #{count} items"- end-- def assert_menu_contains_item_named(menu_name, item_name)- assert Redmine::MenuManager.items(menu_name).map(&:name).include?(item_name.to_sym),- "Menu did not have an item named #{item_name}"- end-- # Helpers- def get_menu_item(menu_name, item_name)- Redmine::MenuManager.items(menu_name).find { |item| item.name == item_name.to_sym }- end-end--describe Redmine do- include RedmineMenuTestHelper-- it 'top_menus' do- assert_number_of_items_in_menu :top_menu, 4- assert_menu_contains_item_named :top_menu, :work_packages- assert_menu_contains_item_named :top_menu, :news- # do not test :projects here. it does not appear in the top_menu data structure, but will be generated by the TopMenuHelper- assert_menu_contains_item_named :top_menu, :help- end-- it 'account_menus' do- assert_number_of_items_in_menu :account_menu, 4- assert_menu_contains_item_named :account_menu, :administration- assert_menu_contains_item_named :account_menu, :my_account- assert_menu_contains_item_named :account_menu, :my_page- assert_menu_contains_item_named :account_menu, :logout- end-- it 'application_menus' do- assert_number_of_items_in_menu :application_menu, 0- end-- it 'admin_menus' do- assert_number_of_items_in_menu :admin_menu, 0- end-- it 'project_menus' do- assert_number_of_items_in_menu :project_menu, 12- assert_menu_contains_item_named :project_menu, :overview- assert_menu_contains_item_named :project_menu, :activity- assert_menu_contains_item_named :project_menu, :roadmap- assert_menu_contains_item_named :project_menu, :work_packages- assert_menu_contains_item_named :project_menu, :news- assert_menu_contains_item_named :project_menu, :forums- assert_menu_contains_item_named :project_menu, :repository- assert_menu_contains_item_named :project_menu, :settings- end-end