Commit d5094e7c authored by Douwe Maan's avatar Douwe Maan

Improve PruneWebHookLogsWorker spec

parent 536c1e40
......@@ -5,18 +5,20 @@ describe PruneWebHookLogsWorker do
before do
hook = create(:project_hook)
5.times do
create(:web_hook_log, web_hook: hook, created_at: 5.months.ago)
end
create(:web_hook_log, web_hook: hook, created_at: 4.months.ago)
create(:web_hook_log, web_hook: hook, created_at: 91.days.ago)
create(:web_hook_log, web_hook: hook, created_at: 89.days.ago)
create(:web_hook_log, web_hook: hook, created_at: 2.months.ago)
create(:web_hook_log, web_hook: hook, created_at: 1.month.ago)
create(:web_hook_log, web_hook: hook, response_status: '404')
end
it 'removes all web hook logs older than one month' do
it 'removes all web hook logs older than 90 days' do
described_class.new.perform
expect(WebHookLog.count).to eq(1)
expect(WebHookLog.first.response_status).to eq('404')
expect(WebHookLog.count).to eq(4)
expect(WebHookLog.last.response_status).to eq('404')
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment