From 34e0c23bb37bbd0c7b9b17d26a71d6adec9802e2 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 15 Jan 2018 20:34:30 +0100 Subject: [PATCH] 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 --- spec/features/valuation_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/features/valuation_spec.rb b/spec/features/valuation_spec.rb index c004f0773..1cb95d23d 100644 --- a/spec/features/valuation_spec.rb +++ b/spec/features/valuation_spec.rb @@ -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