diff --git a/spec/features/basic_search_spec.rb b/spec/features/basic_search_spec.rb index 3c5ee50..62853e9 100644 --- a/spec/features/basic_search_spec.rb +++ b/spec/features/basic_search_spec.rb @@ -1,6 +1,12 @@ require 'rails_helper' RSpec.feature "Basic search", type: :feature, elasticsearch: true do + + before(:each) do + @papers = FactoryGirl.create_list(:paper, 11) + Paper.__elasticsearch__.refresh_index! + end + scenario "It displays the search form" do visit search_path body: "leipzig" expect(page).to have_content("Stadtratmonitor") @@ -12,9 +18,11 @@ RSpec.feature "Basic search", type: :feature, elasticsearch: true do expect(page).to have_field("paper_search_sort_by_score", type: "radio") end - scenario "It displays the search results" do + scenario "It displays a list of search results" do visit search_path body: "leipzig" expect(page).to have_selector("ul#search_results") + expect(page).to have_css("li.search-result", count: 10) + expect(page).to have_content("#{@papers.size} Dokumente in der Datenbank") end end