diff --git a/config/locales/en.yml b/config/locales/en.yml index 1788393dc..580993fe5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -164,6 +164,10 @@ en: filter_topic: one: " with the topic '%{topic}'" other: " with the topic '%{topic}'" + search_form: + title: Search + button: Search + placeholder: "Search proposals..." search_results: one: " containing '%{search_term}'" other: " containing '%{search_term}'" diff --git a/config/locales/es.yml b/config/locales/es.yml index cc797184f..c56e46299 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -164,6 +164,10 @@ es: filter_topic: one: " con el tema '%{topic}'" other: " con el tema '%{topic}'" + search_form: + title: Search + button: Search + placeholder: "Buscar propuestas ciudadanas..." search_results: one: " que contiene '%{search_term}'" other: " que contienen '%{search_term}'" diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 85d0178f6..0f70b4ecc 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -139,4 +139,27 @@ feature 'Proposals' do expect(current_url).to include('page=1') end end + + scenario 'proposal index search' do + proposal1 = create(:proposal, title: "Show me what you got") + proposal2 = create(:proposal, title: "Get Schwifty") + proposal3 = create(:proposal) + proposal4 = create(:proposal, description: "Schwifty in here") + proposal5 = create(:proposal, question: "Schwifty in here") + + visit proposals_path + fill_in "search", with: "Schwifty" + click_button "Search" + + expect(current_path).to eq(proposals_path) + + within("#proposals") do + expect(page).to have_css('.proposal', count: 3) + expect(page).to have_content(proposal2.title) + expect(page).to have_content(proposal4.title) + expect(page).to have_content(proposal5.title) + expect(page).to_not have_content(proposal1.title) + expect(page).to_not have_content(proposal3.title) + end + end end