From 18022020338428446d29da9db4e1e654e565d34a Mon Sep 17 00:00:00 2001 From: Eduardo Martinez Echevarria Date: Sun, 11 Jun 2017 23:29:56 +0200 Subject: [PATCH] Add test to check that results of unfinished budgets are inaccessible --- spec/features/budgets/results_spec.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spec/features/budgets/results_spec.rb b/spec/features/budgets/results_spec.rb index 961dd287e..d2a32f992 100644 --- a/spec/features/budgets/results_spec.rb +++ b/spec/features/budgets/results_spec.rb @@ -45,4 +45,13 @@ feature 'Results' do end end -end \ No newline at end of file + scenario "If budget is in a phase different from finished results can't be accessed" do + budget.update phase: (Budget::PHASES - ["finished"]).sample + visit budget_path(budget) + expect(page).not_to have_link "See results" + + visit budget_results_path(budget, heading_id: budget.headings.first) + expect(page).to have_content "You do not have permission to carry out the action" + end + +end