Remove permissions of obsolete actions. Add missing image managment abilities to common and administrator specs.
This commit is contained in:
@@ -48,7 +48,7 @@ module Abilities
|
|||||||
can [:index, :read, :new, :create, :update, :destroy, :calculate_winners], Budget
|
can [:index, :read, :new, :create, :update, :destroy, :calculate_winners], Budget
|
||||||
can [:read, :create, :update, :destroy], Budget::Group
|
can [:read, :create, :update, :destroy], Budget::Group
|
||||||
can [:read, :create, :update, :destroy], Budget::Heading
|
can [:read, :create, :update, :destroy], Budget::Heading
|
||||||
can [:hide, :update, :toggle_selection, :edit_image, :update_image, :remove_image], Budget::Investment
|
can [:hide, :update, :toggle_selection], Budget::Investment
|
||||||
can :valuate, Budget::Investment
|
can :valuate, Budget::Investment
|
||||||
can :create, Budget::ValuatorAssignment
|
can :create, Budget::ValuatorAssignment
|
||||||
|
|
||||||
|
|||||||
@@ -58,9 +58,6 @@ module Abilities
|
|||||||
can :suggest, Budget::Investment, budget: { phase: "accepting" }
|
can :suggest, Budget::Investment, budget: { phase: "accepting" }
|
||||||
can :destroy, Budget::Investment, budget: { phase: ["accepting", "reviewing"] }, author_id: user.id
|
can :destroy, Budget::Investment, budget: { phase: ["accepting", "reviewing"] }, author_id: user.id
|
||||||
can :vote, Budget::Investment, budget: { phase: "selecting" }
|
can :vote, Budget::Investment, budget: { phase: "selecting" }
|
||||||
can :edit_image, Budget::Investment, author_id: user.id
|
|
||||||
can :update_image, Budget::Investment, author_id: user.id
|
|
||||||
can :remove_image, Budget::Investment, author_id: user.id
|
|
||||||
|
|
||||||
can [:show, :create], Budget::Ballot, budget: { phase: "balloting" }
|
can [:show, :create], Budget::Ballot, budget: { phase: "balloting" }
|
||||||
can [:create, :destroy], Budget::Ballot::Line, budget: { phase: "balloting" }
|
can [:create, :destroy], Budget::Ballot::Line, budget: { phase: "balloting" }
|
||||||
|
|||||||
@@ -85,10 +85,6 @@ describe "Abilities::Administrator" do
|
|||||||
it { should be_able_to(:create, proposal_document) }
|
it { should be_able_to(:create, proposal_document) }
|
||||||
it { should be_able_to(:destroy, proposal_document) }
|
it { should be_able_to(:destroy, proposal_document) }
|
||||||
|
|
||||||
it { should be_able_to(:new, proposal_image) }
|
|
||||||
it { should be_able_to(:create, proposal_image) }
|
|
||||||
it { should be_able_to(:destroy, proposal_image) }
|
|
||||||
|
|
||||||
it { should be_able_to(:new, budget_investment_document) }
|
it { should be_able_to(:new, budget_investment_document) }
|
||||||
it { should be_able_to(:create, budget_investment_document) }
|
it { should be_able_to(:create, budget_investment_document) }
|
||||||
it { should be_able_to(:destroy, budget_investment_document) }
|
it { should be_able_to(:destroy, budget_investment_document) }
|
||||||
@@ -97,6 +93,10 @@ describe "Abilities::Administrator" do
|
|||||||
it { should be_able_to(:create, poll_question_document) }
|
it { should be_able_to(:create, poll_question_document) }
|
||||||
it { should be_able_to(:destroy, poll_question_document) }
|
it { should be_able_to(:destroy, poll_question_document) }
|
||||||
|
|
||||||
|
it { should be_able_to(:new, proposal_image) }
|
||||||
|
it { should be_able_to(:create, proposal_image) }
|
||||||
|
it { should be_able_to(:destroy, proposal_image) }
|
||||||
|
|
||||||
it { should be_able_to(:new, budget_investment_image) }
|
it { should be_able_to(:new, budget_investment_image) }
|
||||||
it { should be_able_to(:create, budget_investment_image) }
|
it { should be_able_to(:create, budget_investment_image) }
|
||||||
it { should be_able_to(:destroy, budget_investment_image) }
|
it { should be_able_to(:destroy, budget_investment_image) }
|
||||||
|
|||||||
@@ -59,6 +59,11 @@ describe "Abilities::Common" do
|
|||||||
let(:own_budget_investment_document) { build(:document, documentable: own_investment_in_accepting_budget) }
|
let(:own_budget_investment_document) { build(:document, documentable: own_investment_in_accepting_budget) }
|
||||||
let(:budget_investment_document) { build(:document, documentable: investment_in_accepting_budget) }
|
let(:budget_investment_document) { build(:document, documentable: investment_in_accepting_budget) }
|
||||||
|
|
||||||
|
let(:own_proposal_image) { build(:image, imageable: own_proposal) }
|
||||||
|
let(:proposal_image) { build(:image, imageable: proposal) }
|
||||||
|
let(:own_budget_investment_image) { build(:image, imageable: own_investment_in_accepting_budget) }
|
||||||
|
let(:budget_investment_image) { build(:image, imageable: investment_in_accepting_budget) }
|
||||||
|
|
||||||
it { should be_able_to(:index, Debate) }
|
it { should be_able_to(:index, Debate) }
|
||||||
it { should be_able_to(:show, debate) }
|
it { should be_able_to(:show, debate) }
|
||||||
it { should be_able_to(:vote, debate) }
|
it { should be_able_to(:vote, debate) }
|
||||||
@@ -106,6 +111,22 @@ describe "Abilities::Common" do
|
|||||||
it { should_not be_able_to(:create, budget_investment_document) }
|
it { should_not be_able_to(:create, budget_investment_document) }
|
||||||
it { should_not be_able_to(:destroy, budget_investment_document) }
|
it { should_not be_able_to(:destroy, budget_investment_document) }
|
||||||
|
|
||||||
|
it { should be_able_to(:new, own_proposal_image) }
|
||||||
|
it { should be_able_to(:create, own_proposal_image) }
|
||||||
|
it { should be_able_to(:destroy, own_proposal_image) }
|
||||||
|
|
||||||
|
it { should_not be_able_to(:new, proposal_image) }
|
||||||
|
it { should_not be_able_to(:create, proposal_image) }
|
||||||
|
it { should_not be_able_to(:destroy, proposal_image) }
|
||||||
|
|
||||||
|
it { should be_able_to(:new, own_budget_investment_image) }
|
||||||
|
it { should be_able_to(:create, own_budget_investment_image) }
|
||||||
|
it { should be_able_to(:destroy, own_budget_investment_image) }
|
||||||
|
|
||||||
|
it { should_not be_able_to(:new, budget_investment_image) }
|
||||||
|
it { should_not be_able_to(:create, budget_investment_image) }
|
||||||
|
it { should_not be_able_to(:destroy, budget_investment_image) }
|
||||||
|
|
||||||
describe 'flagging content' do
|
describe 'flagging content' do
|
||||||
it { should be_able_to(:flag, debate) }
|
it { should be_able_to(:flag, debate) }
|
||||||
it { should be_able_to(:unflag, debate) }
|
it { should be_able_to(:unflag, debate) }
|
||||||
@@ -235,33 +256,6 @@ describe "Abilities::Common" do
|
|||||||
it { should_not be_able_to(:create, ballot_in_accepting_budget) }
|
it { should_not be_able_to(:create, ballot_in_accepting_budget) }
|
||||||
it { should_not be_able_to(:create, ballot_in_selecting_budget) }
|
it { should_not be_able_to(:create, ballot_in_selecting_budget) }
|
||||||
it { should be_able_to(:create, ballot_in_balloting_budget) }
|
it { should be_able_to(:create, ballot_in_balloting_budget) }
|
||||||
|
|
||||||
|
|
||||||
it { should be_able_to(:edit_image, own_investment_in_accepting_budget) }
|
|
||||||
it { should be_able_to(:edit_image, own_investment_in_reviewing_budget) }
|
|
||||||
it { should be_able_to(:edit_image, own_investment_in_selecting_budget) }
|
|
||||||
it { should be_able_to(:edit_image, own_investment_in_balloting_budget) }
|
|
||||||
it { should be_able_to(:update_image, own_investment_in_accepting_budget) }
|
|
||||||
it { should be_able_to(:update_image, own_investment_in_reviewing_budget) }
|
|
||||||
it { should be_able_to(:update_image, own_investment_in_selecting_budget) }
|
|
||||||
it { should be_able_to(:update_image, own_investment_in_balloting_budget) }
|
|
||||||
it { should be_able_to(:remove_image, own_investment_in_accepting_budget) }
|
|
||||||
it { should be_able_to(:remove_image, own_investment_in_reviewing_budget) }
|
|
||||||
it { should be_able_to(:remove_image, own_investment_in_selecting_budget) }
|
|
||||||
it { should be_able_to(:remove_image, own_investment_in_balloting_budget) }
|
|
||||||
|
|
||||||
it { should_not be_able_to(:edit_image, investment_in_accepting_budget) }
|
|
||||||
it { should_not be_able_to(:edit_image, investment_in_reviewing_budget) }
|
|
||||||
it { should_not be_able_to(:edit_image, investment_in_selecting_budget) }
|
|
||||||
it { should_not be_able_to(:edit_image, investment_in_balloting_budget) }
|
|
||||||
it { should_not be_able_to(:update_image, investment_in_accepting_budget) }
|
|
||||||
it { should_not be_able_to(:update_image, investment_in_reviewing_budget) }
|
|
||||||
it { should_not be_able_to(:update_image, investment_in_selecting_budget) }
|
|
||||||
it { should_not be_able_to(:update_image, investment_in_balloting_budget) }
|
|
||||||
it { should_not be_able_to(:remove_image, investment_in_accepting_budget) }
|
|
||||||
it { should_not be_able_to(:remove_image, investment_in_reviewing_budget) }
|
|
||||||
it { should_not be_able_to(:remove_image, investment_in_selecting_budget) }
|
|
||||||
it { should_not be_able_to(:remove_image, investment_in_balloting_budget) }
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user