<%= render @debates %>
diff --git a/app/views/shared/_search_form.html.erb b/app/views/shared/_search_form.html.erb
index 0e3af9a03..e6f7dda0e 100644
--- a/app/views/shared/_search_form.html.erb
+++ b/app/views/shared/_search_form.html.erb
@@ -3,15 +3,19 @@
<%= t("shared.search_form.search_title") %>
\ No newline at end of file
diff --git a/config/locales/en.yml b/config/locales/en.yml
index ce683310b..50bc610b1 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -77,9 +77,11 @@ en:
most_commented: most commented
random: random
filter_topic:
- one: "You are seeing one debate with the topic '%{topic}'"
- other: "You are seeing %{count} debates with the topic '%{topic}'"
- search_results: "Showing %{number} debates containing '%{search_term}'"
+ one: " with the topic '%{topic}'"
+ other: " with the topic '%{topic}'"
+ search_results:
+ one: " containing '%{search_term}'"
+ other: " containing '%{search_term}'"
debate:
debate: Debate
comments:
diff --git a/config/locales/es.yml b/config/locales/es.yml
index e6e8ab462..430a9a363 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -77,9 +77,11 @@ es:
most_commented: "más comentados"
random: "aleatorio"
filter_topic:
- one: "Estás viendo un debate con el tema ''%{topic}''"
- other: "Estás viendo %{count} debates con el tema '%{topic}'"
- search_results: "Mostrando %{number} debates que contienen '%{search_term}'"
+ one: " con el tema '%{topic}'"
+ other: " con el tema '%{topic}'"
+ search_results:
+ one: " que contiene '%{search_term}'"
+ other: " que contienen '%{search_term}'"
debate:
debate: Debate
comments:
diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb
index 5a51b96bf..86903960f 100644
--- a/spec/features/debates_spec.rb
+++ b/spec/features/debates_spec.rb
@@ -441,4 +441,23 @@ feature 'Debates' do
expect(debates_first_time).to_not eq(debates_second_time)
end
end
+
+ scenario 'Debate index search' do
+ debate1 = create(:debate, title: "Show me what you got")
+ debate2 = create(:debate, title: "Get Schwifty")
+ debate3 = create(:debate, description: "Unity")
+ debate4 = create(:debate, description: "Schwifty in here")
+
+ visit debates_path
+ fill_in "search", with: "Schwifty"
+ click_button "Search"
+
+ within("#debates") do
+ expect(page).to have_css('.debate', count: 2)
+ expect(page).to have_content(debate2.title)
+ expect(page).to have_content(debate4.title)
+ expect(page).to_not have_content(debate1.title)
+ expect(page).to_not have_content(debate3.title)
+ end
+ end
end