OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/spec/workers/notifications/cleanup_job_spec.rb

18 lines
600 B

require 'rails_helper'
RSpec.describe Notifications::CleanupJob, type: :job do
let(:job) { described_class.new }
describe 'with default period', with_settings: { notification_retention_period_days: 30 } do
let!(:old_notification) { create :notification }
let!(:new_notification) { create :notification }
it 'removes any older event' do
old_notification.update_column(:updated_at, 31.days.ago)
expect { job.perform }.to change { Notification.count }.from(2).to(1)
expect { old_notification.reload }.to raise_error(ActiveRecord::RecordNotFound)
end
end
end