Browse Source

spec for sub nav logs

pull/627/head
JG 3 years ago
parent
commit
796af8e776
  1. 24
      spec/helpers/navigation_items_helper_spec.rb

24
spec/helpers/navigation_items_helper_spec.rb

@ -81,6 +81,30 @@ RSpec.describe NavigationItemsHelper do
expect(primary_items("/account", current_user)).to eq(expected_navigation_items) expect(primary_items("/account", current_user)).to eq(expected_navigation_items)
end end
end end
context "when the user is on the specific organisation's page" do
context "when the user is on organisation logs page" do
let(:expected_navigation_items) do
[
NavigationItemsHelper::NavigationItem.new("Organisations", "/organisations", true),
NavigationItemsHelper::NavigationItem.new("Users", "/users", false),
NavigationItemsHelper::NavigationItem.new("Logs", "/logs", false),
]
end
let(:expected_secondary_navigation_items) do
[
NavigationItemsHelper::NavigationItem.new("Logs", "/organisations/#{current_user.organisation.id}/logs", true),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About this organisation", "/organisations/#{current_user.organisation.id}", false),
]
end
it "returns navigation items with the logs item set as current" do
expect(secondary_items("/organisations/#{current_user.organisation.id}/logs", current_user.organisation.id)).to eq(expected_secondary_navigation_items)
end
end
end
end end
end end
end end

Loading…
Cancel
Save