Skip to content

Commit

Permalink
making feature test and removing view test
Browse files Browse the repository at this point in the history
  • Loading branch information
hudajkhan committed Sep 23, 2024
1 parent d148308 commit 154c030
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
1 change: 1 addition & 0 deletions app/views/shared/_header_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<%= render blacklight_config.header_component.new(blacklight_config: blacklight_config) %>
<% else %>
<%= render Spotlight::HeaderComponent.new(blacklight_config: blacklight_config) %>
<% ActiveSupport::Deprecation.warn("_header_navbar.html.erb will be deprecated in future versions. Please use Blacklight configuration to specify your HeaderComponent.") %>
<% end %>
26 changes: 26 additions & 0 deletions spec/features/header_links_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

RSpec.describe 'header links', type: :feature do
context 'when not signed in' do
it 'shows sign in' do
visit main_app.root_path

expect(page).to have_link('Sign in', href: '/users/sign_in')
end
end

context 'when signed in' do
let(:user) { FactoryBot.create(:site_admin) }

it 'shows user util links for admin user' do
login_as user

visit main_app.root_path

expect(page).to have_selector '#user-util-collapse', text: 'Site administration'
expect(page).to have_selector '#user-util-collapse', text: 'Create new exhibit'
expect(page).to have_selector '#user-util-collapse', text: 'Change Password'
expect(page).to have_selector '#user-util-collapse', text: 'Sign out'
end
end
end
13 changes: 0 additions & 13 deletions spec/views/shared/_header_navbar.html.erb_spec.rb

This file was deleted.

0 comments on commit 154c030

Please sign in to comment.