Implements #150
Adds an entry inside moderation section that allows moderators to check pending tasks and mark them as solved.
This commit is contained in:
@@ -21,6 +21,7 @@ describe Abilities::Moderator do
|
||||
let(:hidden_debate) { create(:debate, :hidden) }
|
||||
let(:hidden_comment) { create(:comment, :hidden) }
|
||||
let(:hidden_proposal) { create(:proposal, :hidden) }
|
||||
let(:administrator_task) { create(:administrator_task) }
|
||||
|
||||
it { should be_able_to(:index, Debate) }
|
||||
it { should be_able_to(:show, debate) }
|
||||
@@ -31,6 +32,9 @@ describe Abilities::Moderator do
|
||||
|
||||
it { should be_able_to(:read, Organization) }
|
||||
|
||||
it { is_expected.to be_able_to :manage, AdministratorTask }
|
||||
it { is_expected.to be_able_to :manage, administrator_task }
|
||||
|
||||
describe "organizations" do
|
||||
let(:pending_organization) { create(:organization) }
|
||||
let(:rejected_organization) { create(:organization, :rejected) }
|
||||
|
||||
@@ -6,12 +6,17 @@ describe ProposalExecutedDashboardAction do
|
||||
build :proposal_executed_dashboard_action,
|
||||
proposal: proposal,
|
||||
proposal_dashboard_action: proposal_dashboard_action,
|
||||
executed_at: executed_at
|
||||
executed_at: executed_at,
|
||||
comments: comments
|
||||
end
|
||||
|
||||
let(:proposal) { create :proposal }
|
||||
let(:proposal_dashboard_action) { create :proposal_dashboard_action }
|
||||
let(:proposal_dashboard_action) do
|
||||
create :proposal_dashboard_action, request_to_administrators: request_to_administrators, link: Faker::Internet.url
|
||||
end
|
||||
let(:request_to_administrators) { false }
|
||||
let(:executed_at) { Time.now }
|
||||
let(:comments) { '' }
|
||||
|
||||
it { is_expected.to be_valid }
|
||||
|
||||
@@ -33,6 +38,22 @@ describe ProposalExecutedDashboardAction do
|
||||
it { is_expected.not_to be_valid }
|
||||
end
|
||||
|
||||
context 'when the action sends a request to the administrators' do
|
||||
let(:request_to_administrators) { true }
|
||||
|
||||
context 'and comments are blank' do
|
||||
let(:comments) { '' }
|
||||
|
||||
it { is_expected.not_to be_valid }
|
||||
end
|
||||
|
||||
context 'and comments have value' do
|
||||
let(:comments) { Faker::Lorem.sentence }
|
||||
|
||||
it { is_expected.to be_valid }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when it has been already executed' do
|
||||
let!(:executed) { create(:proposal_executed_dashboard_action, proposal: proposal, proposal_dashboard_action: proposal_dashboard_action) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user