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
Extract `have_enterprise_banner` matcher
Christophe Bliarde329baf3eef5
diff --git a/modules/boards/spec/features/board_enterprise_spec.rb b/modules/boards/spec/features/board_enterprise_spec.rbindex 7edb5ba2d1e..d03d11967b8 100644--- a/modules/boards/spec/features/board_enterprise_spec.rb+++ b/modules/boards/spec/features/board_enterprise_spec.rb@@ -67,12 +67,12 @@ RSpec.describe "Boards enterprise spec", :js, :with_cuprite doboard_page = board_index.open_board(manual_board)board_page.expect_query "My board"- expect(page).not_to have_test_selector "op-enterprise-banner"+ expect(page).not_to have_enterprise_bannerboard_index.visit!board_page = board_index.open_board(action_board)board_page.expect_query "Subproject board"- expect(page).to have_test_selector "op-enterprise-banner"+ expect(page).to have_enterprise_bannerendend@@ -95,12 +95,12 @@ RSpec.describe "Boards enterprise spec", :js, :with_cuprite doboard_page = board_index.open_board(manual_board)board_page.expect_query "My board"- expect(page).not_to have_test_selector "op-enterprise-banner"+ expect(page).not_to have_enterprise_bannerboard_index.visit!board_page = board_index.open_board(action_board)board_page.expect_query "Subproject board"- expect(page).not_to have_test_selector "op-enterprise-banner"+ expect(page).not_to have_enterprise_bannerendendenddiff --git a/modules/boards/spec/features/boards_global_create_spec.rb b/modules/boards/spec/features/boards_global_create_spec.rbindex c0cee1e483c..ba3aedd37f0 100644--- a/modules/boards/spec/features/boards_global_create_spec.rb+++ b/modules/boards/spec/features/boards_global_create_spec.rb@@ -51,7 +51,7 @@ RSpec.describe "Boards",context "with a Community Edition", with_ee: %i[] doit "renders an enterprise banner and disables all restriced board types", :aggregate_failures do- expect(page).to have_css("op-enterprise-banner")+ expect(page).to have_enterprise_bannerexpect(page).to have_selector(:radio_button, "Basic")%w[Status Assignee Version Subproject Parent-child].each do |restricted_board_type|diff --git a/spec/support/matchers/has_enterprise_banner.rb b/spec/support/matchers/has_enterprise_banner.rbnew file mode 100644index 00000000000..c2bcb78ed2c--- /dev/null+++ b/spec/support/matchers/has_enterprise_banner.rb@@ -0,0 +1,49 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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.+#++++RSpec::Matchers.define :have_enterprise_banner do |**args|+ include TestSelectorFinders++ match do |page|+ page.has_selector?(test_selector("op-enterprise-banner"), **args)+ end++ match_when_negated do |page|+ page.has_no_selector?(test_selector("op-enterprise-banner"), **args)+ end++ failure_message do+ "expected page to have Enterprise edition banner"+ end++ failure_message_when_negated do+ "expected page not to have Enterprise edition banner"+ end+end