guest_search_spec.rb 863 B

123456789101112131415161718192021222324252627282930
  1. require 'rails_helper'
  2. RSpec.describe 'Public Knowledge Base for guest search', type: :system, authenticated_as: false, searchindex: true do
  3. include_context 'basic Knowledge Base'
  4. before do
  5. configure_elasticsearch(required: true, rebuild: true) do
  6. published_answer && draft_answer && internal_answer
  7. end
  8. visit help_no_locale_path
  9. end
  10. it 'shows no results notification for gibberish search' do
  11. find('.js-search-input').fill_in with: 'Asdasdasdasdasd'
  12. expect(page).to have_text 'No results were found'
  13. end
  14. it 'list published article' do
  15. expect(page).to produce_search_result_for published_answer
  16. end
  17. it 'not list draft article' do
  18. expect(page).not_to produce_search_result_for draft_answer
  19. end
  20. it 'not list internal article' do
  21. expect(page).not_to produce_search_result_for internal_answer
  22. end
  23. end