Unify both Shift task type creation on a single scenario to check double task on same day

This commit is contained in:
Bertocq
2017-10-03 13:29:26 +02:00
parent 690ebfba01
commit 0384baf26a

View File

@@ -30,12 +30,12 @@ feature 'Admin shifts' do
expect(page).to have_content officer.name
end
scenario "Create Vote Collection Shift", :js do
scenario "Create Vote Collection Shift and Recount & Scrutiny Shift on same date", :js do
poll = create(:poll)
vote_collection_dates = (poll.starts_at.to_date..poll.ends_at.to_date).to_a.map { |date| I18n.l(date, format: :long) }
booth = create(:poll_booth)
officer = create(:poll_officer)
vote_collection_dates = (poll.starts_at.to_date..poll.ends_at.to_date).to_a.map { |date| I18n.l(date, format: :long) }
recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).to_a.map { |date| I18n.l(date, format: :long) }
visit admin_booths_path
@@ -60,14 +60,6 @@ feature 'Admin shifts' do
expect(page).to have_content("Collect Votes")
expect(page).to have_content(officer.name)
end
end
scenario "Create Recount & Scrutiny Shift", :js do
poll = create(:poll)
recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).to_a.map { |date| I18n.l(date, format: :long) }
booth = create(:poll_booth)
officer = create(:poll_officer)
visit admin_booths_path
@@ -89,7 +81,7 @@ feature 'Admin shifts' do
expect(page).to have_content "Shift added"
within("#shifts") do
expect(page).to have_css(".shift", count: 1)
expect(page).to have_css(".shift", count: 2)
expect(page).to have_content(I18n.l(poll.ends_at.to_date + 4.days, format: :long))
expect(page).to have_content("Recount & Scrutiny")
expect(page).to have_content(officer.name)