Browse Source

Fix specs and linters

pull/619/head
baarkerlounger 3 years ago
parent
commit
940012d31e
  1. 4
      app/components/primary_navigation_component.rb
  2. 2
      app/views/layouts/application.html.erb
  3. 8
      spec/components/primary_navigation_component_spec.rb

4
app/components/primary_navigation_component.rb

@ -5,4 +5,8 @@ class PrimaryNavigationComponent < ViewComponent::Base
@items = items @items = items
super super
end end
def highlighted_tab?(item, _path)
item[:current]
end
end end

2
app/views/layouts/application.html.erb

@ -66,7 +66,7 @@
<% if !current_user.nil? %> <% if !current_user.nil? %>
<%= render PrimaryNavigationComponent.new( <%= render PrimaryNavigationComponent.new(
items: primary_items(current_user) items: primary_items(current_user),
) %> ) %>
<% end %> <% end %>

8
spec/components/primary_navigation_component_spec.rb

@ -2,9 +2,11 @@ require "rails_helper"
RSpec.describe PrimaryNavigationComponent, type: :component do RSpec.describe PrimaryNavigationComponent, type: :component do
let(:items) do let(:items) do
[{ text: "Organisations", href: "/organisations", current: true }, [
{ text: "Users", href: "/users", current: false }, NavigationItemsHelper::NavigationItem.new("Organisations", "/organisations", true),
{ text: "Logs ", href: "/logs", current: false }] NavigationItemsHelper::NavigationItem.new("Users", "/users", false),
NavigationItemsHelper::NavigationItem.new("Logs ", "/logs", false),
]
end end
context "when the item is 'current' in nav tabs" do context "when the item is 'current' in nav tabs" do

Loading…
Cancel
Save