mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 23:53:15 +01:00
Add feature spec for originator filter
This commit is contained in:
parent
bc9b1c733b
commit
d2da4bece9
1 changed files with 39 additions and 4 deletions
|
@ -3,10 +3,25 @@ require 'rails_helper'
|
||||||
RSpec.feature "Search filters", type: :feature, elasticsearch: true do
|
RSpec.feature "Search filters", type: :feature, elasticsearch: true do
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@antrag = FactoryGirl.create(:paper, paper_type: "Antrag", name: "Mehr Spielplätze in Leipzig")
|
@antrag = FactoryGirl.create(:paper,
|
||||||
@anfrage = FactoryGirl.create(:paper, paper_type: "Anfrage")
|
paper_type: "Antrag",
|
||||||
@vorlage_1 = FactoryGirl.create(:paper, paper_type: "Vorlage", name: "Zustand der Spielplätze")
|
name: "Mehr Spielplätze in Leipzig",
|
||||||
@vorlage_2 = FactoryGirl.create(:paper, paper_type: "Vorlage", name: "Mehr Ampeln in der Innenstadt")
|
originator: "Dezernat Jugend, Soziales, Gesundheit und Schule"
|
||||||
|
)
|
||||||
|
@anfrage = FactoryGirl.create(:paper,
|
||||||
|
paper_type: "Anfrage",
|
||||||
|
originator: "CDU-Fraktion"
|
||||||
|
)
|
||||||
|
@vorlage_1 = FactoryGirl.create(:paper,
|
||||||
|
paper_type: "Vorlage",
|
||||||
|
name: "Zustand der Spielplätze",
|
||||||
|
originator: "Dezernat Jugend, Soziales, Gesundheit und Schule"
|
||||||
|
)
|
||||||
|
@vorlage_2 = FactoryGirl.create(:paper,
|
||||||
|
paper_type: "Vorlage",
|
||||||
|
name: "Mehr Ampeln in der Innenstadt",
|
||||||
|
originator: "Oberbürgermeister"
|
||||||
|
)
|
||||||
Paper.__elasticsearch__.refresh_index!
|
Paper.__elasticsearch__.refresh_index!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,4 +46,24 @@ RSpec.feature "Search filters", type: :feature, elasticsearch: true do
|
||||||
expect(page).to have_css("li.search-result", count: 1, text: "Spielplätze")
|
expect(page).to have_css("li.search-result", count: 1, text: "Spielplätze")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "Displays originators and their respective count within the search results" do
|
||||||
|
visit search_path body: "leipzig"
|
||||||
|
originator_filter = page.find("select#paper_search_originator")
|
||||||
|
expect(originator_filter).to have_css("option", text: "CDU-Fraktion (1)")
|
||||||
|
expect(originator_filter).to have_css("option", text: "Dezernat Jugend, Soziales, Gesundheit und Schule (2)")
|
||||||
|
expect(originator_filter).to have_css("option", text: "Oberbürgermeister (1)")
|
||||||
|
|
||||||
|
visit search_path body: "leipzig", paper_search: {query: "Spielplätze"}
|
||||||
|
originator_filter = page.find("select#paper_search_originator")
|
||||||
|
expect(originator_filter).to have_css("option", text: "Dezernat Jugend, Soziales, Gesundheit und Schule (2)")
|
||||||
|
expect(originator_filter).not_to have_css("option", text: "Oberbürgermeister")
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Filtering by originator", js: true do
|
||||||
|
visit search_path body: "leipzig"
|
||||||
|
expect(page).to have_css("li.search-result", count: 4)
|
||||||
|
select "Oberbürgermeister (1)", from: "Einreicher"
|
||||||
|
expect(page).to have_css("li.search-result", count: 1, text: "Ampeln")
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue