Fix valuators authorization spec
This spec used to pass, because even though there were no budgets, as Budget.current returned an array, it gracefully handled situations without budgets Now we assume that there can only be a single current budget, and so calling any method of budget will raise an exception unless there is a current budget present Valuators should not access this page when there is no budget present, however it might be wise to create an issue to cover this case, just in case
This commit is contained in:
@@ -66,6 +66,8 @@ feature 'Valuation' do
|
||||
|
||||
scenario 'Access as a valuator is authorized' do
|
||||
create(:valuator, user: user)
|
||||
create(:budget)
|
||||
|
||||
login_as(user)
|
||||
visit root_path
|
||||
|
||||
@@ -78,6 +80,8 @@ feature 'Valuation' do
|
||||
|
||||
scenario 'Access as an administrator is authorized' do
|
||||
create(:administrator, user: user)
|
||||
create(:budget)
|
||||
|
||||
login_as(user)
|
||||
visit root_path
|
||||
|
||||
@@ -90,6 +94,8 @@ feature 'Valuation' do
|
||||
|
||||
scenario "Valuation access links" do
|
||||
create(:valuator, user: user)
|
||||
create(:budget)
|
||||
|
||||
login_as(user)
|
||||
visit root_path
|
||||
|
||||
@@ -100,6 +106,8 @@ feature 'Valuation' do
|
||||
|
||||
scenario 'Valuation dashboard' do
|
||||
create(:valuator, user: user)
|
||||
create(:budget)
|
||||
|
||||
login_as(user)
|
||||
visit root_path
|
||||
|
||||
|
||||
Reference in New Issue
Block a user