Merge pull request #1923 from wairbut-m2c/iagirre-preview-budget-results
Admins can see the preview of the budgets' results before the balloti…
This commit is contained in:
@@ -45,7 +45,7 @@ module Abilities
|
||||
|
||||
can [:read, :update, :valuate, :destroy, :summary], SpendingProposal
|
||||
|
||||
can [:index, :read, :new, :create, :update, :destroy, :calculate_winners], Budget
|
||||
can [:index, :read, :new, :create, :update, :destroy, :calculate_winners, :read_results], Budget
|
||||
can [:read, :create, :update, :destroy], Budget::Group
|
||||
can [:read, :create, :update, :destroy], Budget::Heading
|
||||
can [:hide, :update, :toggle_selection], Budget::Investment
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if @budget.finished? %>
|
||||
<% if @budget.finished? || (@budget.balloting? && can?(:read_results, @budget)) %>
|
||||
<%= link_to t("budgets.show.see_results"),
|
||||
budget_results_path(@budget, heading_id: @budget.headings.first),
|
||||
class: "button margin-top expanded" %>
|
||||
|
||||
@@ -72,6 +72,7 @@ describe "Abilities::Administrator" do
|
||||
|
||||
it { should be_able_to(:create, Budget) }
|
||||
it { should be_able_to(:update, Budget) }
|
||||
it { should be_able_to(:read_results, Budget) }
|
||||
|
||||
it { should be_able_to(:create, Budget::ValuatorAssignment) }
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ describe "Abilities::Everyone" do
|
||||
let(:debate) { create(:debate) }
|
||||
let(:proposal) { create(:proposal) }
|
||||
|
||||
let(:reviewing_ballot_budget) { create(:budget, phase: 'reviewing_ballots') }
|
||||
let(:finished_budget) { create(:budget, phase: 'finished') }
|
||||
|
||||
it { should be_able_to(:index, Debate) }
|
||||
it { should be_able_to(:show, debate) }
|
||||
it { should_not be_able_to(:edit, Debate) }
|
||||
@@ -28,4 +31,7 @@ describe "Abilities::Everyone" do
|
||||
it { should_not be_able_to(:create, SpendingProposal) }
|
||||
|
||||
it { should be_able_to(:index, Budget) }
|
||||
end
|
||||
|
||||
it { should be_able_to(:read_results, finished_budget) }
|
||||
it { should_not be_able_to(:read_results, reviewing_ballot_budget) }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user