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