adds validation for custom dates in advanced search

avoids error 500 on invalid dates
This commit is contained in:
Juanjo Bazán
2017-03-27 12:18:45 +02:00
parent ecfad7b053
commit 652aff4e19
3 changed files with 47 additions and 3 deletions

View File

@@ -980,6 +980,28 @@ feature 'Proposals' do
end
end
scenario "Search by custom invalid date range", :js do
proposal1 = create(:proposal, created_at: 2.days.ago)
proposal2 = create(:proposal, created_at: 3.days.ago)
proposal3 = create(:proposal, created_at: 9.days.ago)
visit proposals_path
click_link "Advanced search"
select "Customized", from: "js-advanced-search-date-min"
fill_in "advanced_search_date_min", with: 4000.years.ago
fill_in "advanced_search_date_max", with: "wrong date"
click_button "Filter"
expect(page).to have_content("There are 3 citizen proposals")
within("#proposals") do
expect(page).to have_content(proposal1.title)
expect(page).to have_content(proposal2.title)
expect(page).to have_content(proposal3.title)
end
end
scenario "Search by multiple filters", :js do
ana = create :user, official_level: 1
john = create :user, official_level: 1