From 88d4de0a25b5ace22ecc0ee84cb59d190a5ffdd3 Mon Sep 17 00:00:00 2001 From: Kat Date: Wed, 20 Apr 2022 10:08:14 +0100 Subject: [PATCH] lint and remove old tests --- app/controllers/organisations_controller.rb | 3 ++- app/controllers/users_controller.rb | 2 +- .../tab_navigation_component_spec.rb | 27 ------------------- 3 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 spec/components/tab_navigation_component_spec.rb diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index 94405eadf..36818db4b 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -4,7 +4,7 @@ class OrganisationsController < ApplicationController before_action :authenticate_scope! def index - if !current_user.support? + unless current_user.support? redirect_to user_path(current_user) end end @@ -52,6 +52,7 @@ private def find_resource return if current_user.support? + @organisation = Organisation.find(params[:id]) end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5f600b71f..f687b0b6a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -6,7 +6,7 @@ class UsersController < ApplicationController before_action :authenticate_scope!, except: %i[new] def index - if !current_user.support? + unless current_user.support? redirect_to user_path(@user) end end diff --git a/spec/components/tab_navigation_component_spec.rb b/spec/components/tab_navigation_component_spec.rb deleted file mode 100644 index e160a3766..000000000 --- a/spec/components/tab_navigation_component_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require "rails_helper" - -RSpec.describe TabNavigationComponent, type: :component do - let(:items) do - [{ name: "Application", url: "#", current: true }, - { name: "Notes", url: "#" }, - { name: "Timeline", url: "#" }] - end - - context "when the item is 'current' in nav tabs" do - it "then that tab appears as selected" do - result = render_inline(described_class.new(items:)) - - expect(result.css('.app-tab-navigation__link[aria-current="page"]').text).to include("Application") - end - end - - context "when rendering tabs" do - it "all of the nav tabs specified in the items hash are passed to it" do - result = render_inline(described_class.new(items:)) - - expect(result.text).to include("Application") - expect(result.text).to include("Notes") - expect(result.text).to include("Timeline") - end - end -end