From 0384baf26aac314fac2afa9e8aa18ef24dc1cd4a Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 3 Oct 2017 13:29:26 +0200 Subject: [PATCH] Unify both Shift task type creation on a single scenario to check double task on same day --- spec/features/admin/poll/shifts_spec.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/spec/features/admin/poll/shifts_spec.rb b/spec/features/admin/poll/shifts_spec.rb index 46c737c64..2e957ef11 100644 --- a/spec/features/admin/poll/shifts_spec.rb +++ b/spec/features/admin/poll/shifts_spec.rb @@ -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)