2024-03-07 23:53:37 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe NotificationPolicy do
|
|
|
|
describe '#summarize!' do
|
|
|
|
subject { Fabricate(:notification_policy) }
|
|
|
|
|
|
|
|
let(:sender) { Fabricate(:account) }
|
|
|
|
|
|
|
|
before do
|
2024-08-07 20:12:36 +09:00
|
|
|
Fabricate.times(2, :notification, account: subject.account, activity: Fabricate(:status, account: sender), filtered: true, type: :mention)
|
2024-03-07 23:53:37 +09:00
|
|
|
Fabricate(:notification_request, account: subject.account, from_account: sender)
|
|
|
|
subject.summarize!
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'sets pending_requests_count' do
|
|
|
|
expect(subject.pending_requests_count).to eq 1
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'sets pending_notifications_count' do
|
|
|
|
expect(subject.pending_notifications_count).to eq 2
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|