Browse Source

lint and remove old tests

pull/477/head
Kat 3 years ago committed by Paul Robert Lloyd
parent
commit
88d4de0a25
  1. 3
      app/controllers/organisations_controller.rb
  2. 2
      app/controllers/users_controller.rb
  3. 27
      spec/components/tab_navigation_component_spec.rb

3
app/controllers/organisations_controller.rb

@ -4,7 +4,7 @@ class OrganisationsController < ApplicationController
before_action :authenticate_scope! before_action :authenticate_scope!
def index def index
if !current_user.support? unless current_user.support?
redirect_to user_path(current_user) redirect_to user_path(current_user)
end end
end end
@ -52,6 +52,7 @@ private
def find_resource def find_resource
return if current_user.support? return if current_user.support?
@organisation = Organisation.find(params[:id]) @organisation = Organisation.find(params[:id])
end end
end end

2
app/controllers/users_controller.rb

@ -6,7 +6,7 @@ class UsersController < ApplicationController
before_action :authenticate_scope!, except: %i[new] before_action :authenticate_scope!, except: %i[new]
def index def index
if !current_user.support? unless current_user.support?
redirect_to user_path(@user) redirect_to user_path(@user)
end end
end end

27
spec/components/tab_navigation_component_spec.rb

@ -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
Loading…
Cancel
Save