discourse/spec/requests/admin/search_controller_spec.rb
Martin Brennan b54c49cca7
DEV: Refactor admin search index into a service (#38959)
Move the AdminSearchController#index endpoint into a proper
service class since it does a few different things now.
2026-04-01 10:09:10 +10:00

31 lines
909 B
Ruby

# frozen_string_literal: true
RSpec.describe Admin::SearchController do
fab!(:admin)
before { sign_in(admin) }
describe "#index" do
it "includes settings, themes and components, reports, and upcoming changes" do
get "/admin/search/all.json"
expect(response.status).to eq(200)
expect(response.parsed_body["settings"]).to be_present
expect(response.parsed_body["themes_and_components"]).to be_present
expect(response.parsed_body["reports"]).to be_present
expect(response.parsed_body["upcoming_changes"]).to be_present
end
it "includes default_locale setting in search results for general searches" do
get "/admin/search/all.json"
expect(response.status).to eq(200)
locale_setting =
response.parsed_body["settings"].find { |s| s["setting"] == "default_locale" }
expect(locale_setting).to be_present
end
end
end