From 730dae26c681c138ed88cefa22656fba33987689 Mon Sep 17 00:00:00 2001 From: Jeremy Friesen Date: Wed, 4 Oct 2023 14:03:31 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Remove=20MenuPresenter=20spec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In reviewing the diff, the specs for knapsack were a subset of the hyku spec fo MenuPresenter. I copied over the Hyku spec and ran them; all things passed so I feel confident deleting the MenuPresenter spec. Related to: - https://github.com/scientist-softserv/adventist-dl/issues/538 --- spec/presenters/hyku/menu_presenter_spec.rb | 122 -------------------- 1 file changed, 122 deletions(-) delete mode 100644 spec/presenters/hyku/menu_presenter_spec.rb diff --git a/spec/presenters/hyku/menu_presenter_spec.rb b/spec/presenters/hyku/menu_presenter_spec.rb deleted file mode 100644 index 30fe649b..00000000 --- a/spec/presenters/hyku/menu_presenter_spec.rb +++ /dev/null @@ -1,122 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Hyku::MenuPresenter do - let(:instance) { described_class.new(context) } - let(:context) { double } - let(:controller_name) { controller.controller_name } - - describe "#repository_activity_section?" do - subject { instance.repository_activity_section? } - - before do - allow(context).to receive(:controller_name).and_return(controller_name) - allow(context).to receive(:controller).and_return(controller) - end - - context "when the ContentBlocksController" do - let(:controller) { Hyrax::ContentBlocksController.new } - - it { is_expected.to be false } - end - - context "when the StatusController" do - let(:controller) { StatusController.new } - - it { is_expected.to be true } - end - - context "when the Hyrax::DashboardController" do - let(:controller) { Hyrax::DashboardController.new } - - it { is_expected.to be true } - end - end - - describe "#settings_section?" do - subject { instance.settings_section? } - - before do - allow(context).to receive(:controller_name).and_return(controller_name) - allow(context).to receive(:controller).and_return(controller) - end - - context "when the ContentBlocksController" do - let(:controller) { Hyrax::ContentBlocksController.new } - - it { is_expected.to be true } - end - - context "when the Admin::GroupsController" do - let(:controller) { Admin::GroupsController.new } - - it { is_expected.to be false } - end - end - - describe "#roles_and_permissions_section?" do - subject { instance.roles_and_permissions_section? } - - before do - allow(context).to receive(:controller_name).and_return(controller_name) - allow(context).to receive(:controller).and_return(controller) - end - - context "when the Hyrax::UsersController" do - let(:controller) { Hyrax::UsersController.new } - - it { is_expected.to be false } - end - - context "when the Hyrax::Admin::UsersController" do - let(:controller) { Hyrax::Admin::UsersController.new } - - it { is_expected.to be true } - end - - context "when the Admin::GroupsController" do - let(:controller) { Admin::GroupsController.new } - - it { is_expected.to be true } - end - end - - describe "#show_configuration?" do - subject { instance.show_configuration? } - - context "when a regular user" do - before do - allow(instance.view_context).to receive(:can?).and_return(false) - end - - it { is_expected.to be false } - end - - context "when a user who can manage users" do - before do - allow(instance.view_context).to receive(:can?).and_return(true) - end - - it { is_expected.to be true } - end - end - - describe "#show_admin_menu_items?" do - subject { instance.show_admin_menu_items? } - - context "when a regular user" do - before do - allow(instance.view_context).to receive(:can?).with(:read, :admin_dashboard).and_return(false) - end - - it { is_expected.to be false } - end - - context "when a user who can manage users" do - before do - allow(instance.view_context).to receive(:can?).with(:read, :admin_dashboard).and_return(true) - end - - it { is_expected.to be true } - end - end -end