From e0573b703f8efea5283c56b4e71f60f68188cbce Mon Sep 17 00:00:00 2001 From: Lars Henrik Mai Date: Sat, 20 Feb 2016 07:48:01 +0100 Subject: [PATCH] Add search results to feature spec --- spec/features/basic_search_spec.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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