From 6dd6387b396767510a8feb8d3556f0bcec89689d Mon Sep 17 00:00:00 2001 From: Lars Henrik Mai Date: Fri, 19 Feb 2016 08:22:36 +0100 Subject: [PATCH] Initial feature spec for search page --- app/views/search/index.html.slim | 2 +- spec/features/basic_search_spec.rb | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 spec/features/basic_search_spec.rb diff --git a/app/views/search/index.html.slim b/app/views/search/index.html.slim index 46c8779..1a947b2 100644 --- a/app/views/search/index.html.slim +++ b/app/views/search/index.html.slim @@ -18,7 +18,7 @@ div - else | #{@papers.total} Dokumente in der Datenbank div - ul.no-bullet + ul.no-bullet#search_results - @papers.each do |doc| li.search-result small = doc.paper_type diff --git a/spec/features/basic_search_spec.rb b/spec/features/basic_search_spec.rb new file mode 100644 index 0000000..3c5ee50 --- /dev/null +++ b/spec/features/basic_search_spec.rb @@ -0,0 +1,20 @@ +require 'rails_helper' + +RSpec.feature "Basic search", type: :feature, elasticsearch: true do + scenario "It displays the search form" do + visit search_path body: "leipzig" + expect(page).to have_content("Stadtratmonitor") + expect(page).to have_field("paper_search_query") + expect(page).to have_select("Typ") + expect(page).to have_select("Einreicher") + expect(page).to have_selector("label", text: "Sortierung") + expect(page).to have_field("paper_search_sort_by_date", type: "radio") + expect(page).to have_field("paper_search_sort_by_score", type: "radio") + end + + scenario "It displays the search results" do + visit search_path body: "leipzig" + expect(page).to have_selector("ul#search_results") + end + +end