Don't generate stats for budget polls
The link to show stats for these polls is nowhere to be seen in the application, and these stats are included in the budget stats, so it makes sense to restrict access to them.
This commit is contained in:
@@ -7,8 +7,8 @@ module Abilities
|
|||||||
can [:read, :map, :summary, :share], Proposal
|
can [:read, :map, :summary, :share], Proposal
|
||||||
can :read, Comment
|
can :read, Comment
|
||||||
can :read, Poll
|
can :read, Poll
|
||||||
can :results, Poll, id: Poll.expired.results_enabled.ids
|
can :results, Poll, id: Poll.expired.results_enabled.not_budget.ids
|
||||||
can :stats, Poll, id: Poll.expired.stats_enabled.ids
|
can :stats, Poll, id: Poll.expired.stats_enabled.not_budget.ids
|
||||||
can :read, Poll::Question
|
can :read, Poll::Question
|
||||||
can :read, User
|
can :read, User
|
||||||
can [:read, :welcome], Budget
|
can [:read, :welcome], Budget
|
||||||
|
|||||||
@@ -34,10 +34,12 @@ describe Abilities::Everyone do
|
|||||||
it { should be_able_to(:results, create(:poll, :expired, results_enabled: true)) }
|
it { should be_able_to(:results, create(:poll, :expired, results_enabled: true)) }
|
||||||
it { should_not be_able_to(:results, create(:poll, :expired, results_enabled: false)) }
|
it { should_not be_able_to(:results, create(:poll, :expired, results_enabled: false)) }
|
||||||
it { should_not be_able_to(:results, create(:poll, :current, results_enabled: true)) }
|
it { should_not be_able_to(:results, create(:poll, :current, results_enabled: true)) }
|
||||||
|
it { should_not be_able_to(:results, create(:poll, :for_budget, :expired, results_enabled: true)) }
|
||||||
|
|
||||||
it { should be_able_to(:stats, create(:poll, :expired, stats_enabled: true)) }
|
it { should be_able_to(:stats, create(:poll, :expired, stats_enabled: true)) }
|
||||||
it { should_not be_able_to(:stats, create(:poll, :expired, stats_enabled: false)) }
|
it { should_not be_able_to(:stats, create(:poll, :expired, stats_enabled: false)) }
|
||||||
it { should_not be_able_to(:stats, create(:poll, :current, stats_enabled: true)) }
|
it { should_not be_able_to(:stats, create(:poll, :current, stats_enabled: true)) }
|
||||||
|
it { should_not be_able_to(:stats, create(:poll, :for_budget, :expired, stats_enabled: true)) }
|
||||||
|
|
||||||
it { should be_able_to(:read_results, create(:budget, :finished, results_enabled: true)) }
|
it { should be_able_to(:read_results, create(:budget, :finished, results_enabled: true)) }
|
||||||
it { should_not be_able_to(:read_results, create(:budget, :finished, results_enabled: false)) }
|
it { should_not be_able_to(:read_results, create(:budget, :finished, results_enabled: false)) }
|
||||||
|
|||||||
Reference in New Issue
Block a user