Use separate actions to select/deselect investments
This is consistent to what we usually do. Also, we're applying the same
criteria mentioned in commit 72704d776:
> We're also making these actions idempotent, so sending many requests
> to the same action will get the same result, which wasn't the case
> with the `toggle` action. Although it's a low probability case, the
> `toggle` action could result in [selecting an investment] when trying
> to [deselect] it if someone else has [deselected it] it between the
> time the page loaded and the time the admin clicked on the
> "[Selected]" button.
This commit is contained in:
@@ -116,10 +116,10 @@ describe Abilities::Administrator do
|
||||
it { should_not be_able_to(:valuate, finished_investment) }
|
||||
it { should_not be_able_to(:comment_valuation, finished_investment) }
|
||||
|
||||
it { should be_able_to(:toggle_selection, create(:budget_investment, :feasible, :finished)) }
|
||||
it { should_not be_able_to(:toggle_selection, create(:budget_investment, :feasible, :open)) }
|
||||
it { should_not be_able_to(:toggle_selection, create(:budget_investment, :unfeasible, :finished)) }
|
||||
it { should_not be_able_to(:toggle_selection, finished_investment) }
|
||||
it { should be_able_to([:select, :deselect], create(:budget_investment, :feasible, :finished)) }
|
||||
it { should_not be_able_to([:select, :deselect], create(:budget_investment, :feasible, :open)) }
|
||||
it { should_not be_able_to([:select, :deselect], create(:budget_investment, :unfeasible, :finished)) }
|
||||
it { should_not be_able_to([:select, :deselect], finished_investment) }
|
||||
|
||||
it { should be_able_to(:destroy, proposal_image) }
|
||||
it { should be_able_to(:destroy, proposal_document) }
|
||||
|
||||
Reference in New Issue
Block a user