Skip to content

Commit

Permalink
Avoid deprecated method render_search_bar
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne authored and thatbudakguy committed Feb 14, 2023
1 parent 08a800e commit cf2f074
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion app/views/shared/_exhibit_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
</ul>
<% if should_render_spotlight_search_bar? %>
<div class="navbar-right navbar-nav exhibit-search-form mt-3 mt-md-0">
<%= render_search_bar %>
<%= render Blacklight::SearchBarComponent.new(
url: search_action_url,
advanced_search_url: search_action_url(action: 'advanced_search'),
params: search_state.params_for_search.except(:qt),
autocomplete_path: suggest_index_catalog_path
) %>
</div>
<% end %>
</div>
Expand Down
8 changes: 6 additions & 2 deletions spec/views/shared/_exhibit_navbar.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# frozen_string_literal: true

describe 'shared/_exhibit_navbar', type: :view do
RSpec.describe 'shared/_exhibit_navbar', type: :view do
let(:current_exhibit) { FactoryBot.create(:exhibit) }
let(:feature_page) { FactoryBot.create(:feature_page, exhibit: current_exhibit) }
let(:unpublished_feature_page) { FactoryBot.create(:feature_page, published: false, exhibit: current_exhibit) }
let(:about_page) { FactoryBot.create(:about_page, exhibit: current_exhibit) }
let(:unpublished_about_page) { FactoryBot.create(:about_page, published: false, exhibit: current_exhibit) }

before do
allow(view).to receive(:search_action_url).and_return('/catalog')
allow(view).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)

allow(view).to receive_messages(resource_masthead?: false)
allow(view).to receive_messages(current_exhibit: current_exhibit)
allow(view).to receive_messages(on_browse_page?: false, on_about_page?: false)
allow(view).to receive_messages(render_search_bar: 'Search Bar')
allow(view).to receive(:render).and_call_original
allow(view).to receive(:render).with(Blacklight::SearchBarComponent).and_return('Search Bar')
allow(view).to receive_messages(exhibit_path: spotlight.exhibit_path(current_exhibit))
end

Expand Down

0 comments on commit cf2f074

Please sign in to comment.