Add search results to feature spec

This commit is contained in:
Lars Henrik Mai 2016-02-20 07:48:01 +01:00
parent aa4a6b6958
commit e0573b703f

View file

@ -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