From 47d626619fcab1a6372b1ac516bbf39962364dd6 Mon Sep 17 00:00:00 2001 From: decabeza Date: Sat, 21 Oct 2017 17:37:37 +0200 Subject: [PATCH] adds specs for admin access to officing --- spec/features/officing_spec.rb | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/spec/features/officing_spec.rb b/spec/features/officing_spec.rb index 338b416ea..b208b735c 100644 --- a/spec/features/officing_spec.rb +++ b/spec/features/officing_spec.rb @@ -55,7 +55,22 @@ feature 'Poll Officing' do expect(page).to have_content "You do not have permission to access this page" end - scenario 'Access as an poll officer is authorized' do + scenario 'Access as an administrator is not authorized' do + create(:administrator, user: user) + create(:poll) + login_as(user) + visit root_path + + expect(page).to_not have_link("Polling officers") + visit officing_root_path + + expect(current_path).not_to eq(officing_root_path) + expect(current_path).to eq(root_path) + expect(page).to have_content "You do not have permission to access this page" + end + + scenario 'Access as an administrator with poll officer role is authorized' do + create(:administrator, user: user) create(:poll_officer, user: user) create(:poll) login_as(user) @@ -68,8 +83,8 @@ feature 'Poll Officing' do expect(page).to_not have_content "You do not have permission to access this page" end - scenario 'Access as an administrator is authorized' do - create(:administrator, user: user) + scenario 'Access as an poll officer is authorized' do + create(:poll_officer, user: user) create(:poll) login_as(user) visit root_path