mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 15:43:14 +01:00
Add search results to feature spec
This commit is contained in:
parent
aa4a6b6958
commit
e0573b703f
1 changed files with 9 additions and 1 deletions
|
@ -1,6 +1,12 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.feature "Basic search", type: :feature, elasticsearch: true do
|
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
|
scenario "It displays the search form" do
|
||||||
visit search_path body: "leipzig"
|
visit search_path body: "leipzig"
|
||||||
expect(page).to have_content("Stadtratmonitor")
|
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")
|
expect(page).to have_field("paper_search_sort_by_score", type: "radio")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "It displays the search results" do
|
scenario "It displays a list of search results" do
|
||||||
visit search_path body: "leipzig"
|
visit search_path body: "leipzig"
|
||||||
expect(page).to have_selector("ul#search_results")
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue