mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 23:53:15 +01:00
Add feature specs for simple search queries
This commit is contained in:
parent
1bbcbdc94e
commit
0d09ebaad3
2 changed files with 22 additions and 1 deletions
|
@ -8,7 +8,7 @@ div
|
||||||
.right
|
.right
|
||||||
/ button.button. TODO: Suche Abbonieren
|
/ button.button. TODO: Suche Abbonieren
|
||||||
- else
|
- else
|
||||||
| #{@papers.total} Dokumente in der Datenbank
|
| #{pluralize(@papers.total, "Dokument", "Dokumente")} in der Datenbank
|
||||||
div
|
div
|
||||||
ul.no-bullet#search_results
|
ul.no-bullet#search_results
|
||||||
- @papers.each do |doc|
|
- @papers.each do |doc|
|
||||||
|
|
|
@ -53,4 +53,25 @@ RSpec.feature "Basic search", type: :feature, elasticsearch: true do
|
||||||
expect(result).to have_css("span.published", text: I18n.l(paper.published_at.to_date))
|
expect(result).to have_css("span.published", text: I18n.l(paper.published_at.to_date))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "Finds papers by name" do
|
||||||
|
paper = FactoryGirl.create(:paper, name: "Opendata als default")
|
||||||
|
Paper.__elasticsearch__.refresh_index!
|
||||||
|
visit search_path body: "leipzig", paper_search: {query: "Opendata"}
|
||||||
|
expect(page).to have_content("1 Dokument in der Datenbank")
|
||||||
|
result = page.find("li.search-result", match: :first)
|
||||||
|
expect(result).to have_link(paper.name, href: paper.url)
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Finds papers by content" do
|
||||||
|
paper = FactoryGirl.create(:paper,
|
||||||
|
name: "Opendata als default",
|
||||||
|
content: "Alle Verwaltungsdokumente werden als Opendata veröffentlicht"
|
||||||
|
)
|
||||||
|
Paper.__elasticsearch__.refresh_index!
|
||||||
|
visit search_path body: "leipzig", paper_search: {query: "Verwaltungsdokumente"}
|
||||||
|
expect(page).to have_content("1 Dokument in der Datenbank")
|
||||||
|
result = page.find("li.search-result", match: :first)
|
||||||
|
expect(result).to have_link(paper.name, href: paper.url)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue