adds poll_officer case to restricted zones specs

This commit is contained in:
Juanjo Bazán
2016-12-28 20:55:16 +01:00
parent ca0e6d6694
commit 42412e2402
4 changed files with 42 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
<div class="admin-sidebar">
<ul id="admin_menu">
<ul id="officing_menu">
<li <%= "class=active" if controller_name == "voters" %>>
<%= link_to new_officing_poll_voter_path(Poll.last) do %>

View File

@@ -16,7 +16,7 @@ feature 'Admin' do
expect(page).to have_content "You do not have permission to access this page"
end
scenario 'Access as a moderator is not authorized' do
scenario 'Access as moderator is not authorized' do
create(:moderator, user: user)
login_as(user)
visit admin_root_path
@@ -26,7 +26,7 @@ feature 'Admin' do
expect(page).to have_content "You do not have permission to access this page"
end
scenario 'Access as a valuator is not authorized' do
scenario 'Access as valuator is not authorized' do
create(:valuator, user: user)
login_as(user)
visit admin_root_path
@@ -36,7 +36,7 @@ feature 'Admin' do
expect(page).to have_content "You do not have permission to access this page"
end
scenario 'Access as a manager is not authorized' do
scenario 'Access as manager is not authorized' do
create(:manager, user: user)
login_as(user)
visit admin_root_path
@@ -46,7 +46,17 @@ feature 'Admin' do
expect(page).to have_content "You do not have permission to access this page"
end
scenario 'Access as an administrator is authorized' do
scenario 'Access as poll officer is not authorized' do
create(:poll_officer, user: user)
login_as(user)
visit admin_root_path
expect(current_path).not_to eq(admin_root_path)
expect(current_path).to eq(proposals_path)
expect(page).to have_content "You do not have permission to access this page"
end
scenario 'Access as administrator is authorized' do
login_as(administrator)
visit admin_root_path

View File

@@ -43,6 +43,20 @@ feature 'Moderation' do
expect(page).to have_content "You do not have permission to access this page"
end
scenario 'Access as poll officer is not authorized' do
create(:poll_officer, user: user)
login_as(user)
visit root_path
expect(page).to_not have_link("Moderation")
visit moderation_root_path
expect(current_path).not_to eq(moderation_root_path)
expect(current_path).to eq(proposals_path)
expect(page).to have_content "You do not have permission to access this page"
end
scenario 'Access as a moderator is authorized' do
create(:moderator, user: user)

View File

@@ -41,6 +41,19 @@ feature 'Valuation' do
expect(page).to have_content "You do not have permission to access this page"
end
scenario 'Access as poll officer is not authorized' do
create(:poll_officer, user: user)
login_as(user)
visit root_path
expect(page).to_not have_link("Valuation")
visit valuation_root_path
expect(current_path).not_to eq(valuation_root_path)
expect(current_path).to eq(proposals_path)
expect(page).to have_content "You do not have permission to access this page"
end
scenario 'Access as a valuator is authorized' do
create(:valuator, user: user)
login_as(user)