Adds moderate actions to proposal system notifications

This commit is contained in:
María Checa
2018-05-15 12:55:51 +02:00
committed by decabeza
parent 3cc8b1d123
commit f1e7b634ba
4 changed files with 55 additions and 27 deletions

View File

@@ -152,5 +152,21 @@ describe ProposalNotification do
end
describe "#moderate_system_email" do
let(:admin) { create(:administrator) }
let(:proposal) { create(:proposal) }
let(:proposal_notification) { build(:proposal_notification, proposal: proposal) }
let(:notification) { create(:notification, notifiable: proposal_notification) }
it "removes all notifications related to the proposal notification" do
proposal_notification.moderate_system_email(admin.user)
expect(Notification.all.count).to be(0)
end
it "records the moderation action in the Activity table" do
proposal_notification.moderate_system_email(admin.user)
expect(Activity.last.actionable_type).to eq('ProposalNotification')
end
end
end
end