Added check in poll card that allows setting the value of
results_enabled flag.

Access to stats/results now is controlled with abilities.

Polls related to proposals will be accessible to the proposal author
like they were administrators.
This commit is contained in:
Juan Salvador Pérez García
2018-07-13 10:39:49 +02:00
parent 0daaf9e7db
commit f439fc7371
16 changed files with 93 additions and 10 deletions

View File

@@ -6,6 +6,7 @@ describe Abilities::Administrator do
let(:user) { administrator.user }
let(:administrator) { create(:administrator) }
let(:poll) { create(:poll, :current, stats_enabled: false, results_enabled: false) }
let(:other_user) { create(:user) }
let(:hidden_user) { create(:user, :hidden) }
@@ -91,6 +92,9 @@ describe Abilities::Administrator do
it { should_not be_able_to(:destroy, budget_investment_document) }
it { should be_able_to(:manage, ProposalDashboardAction) }
it { should be_able_to(:stats, poll) }
it { should be_able_to(:results, poll) }
it { is_expected.to be_able_to :manage, AdministratorTask }
it { is_expected.to be_able_to :manage, administrator_task }
end