adds specs for admin access to officing

This commit is contained in:
decabeza
2017-10-21 17:37:37 +02:00
parent 573961a321
commit 47d626619f

View File

@@ -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