~cytrogen/masto-fe

ref: 685270f3f7ea6d4a8a48ec641e8fdfd9fc2e2d7f masto-fe/spec/lib/vacuum/imports_vacuum_spec.rb -rw-r--r-- 946 bytes
685270f3 — Claire [Glitch] Fix clicking “Explore” or “Live feeds” column headers to scroll in advanced mode 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Vacuum::ImportsVacuum do
  subject { described_class.new }

  let!(:old_unconfirmed) { Fabricate(:bulk_import, state: :unconfirmed, created_at: 2.days.ago) }
  let!(:new_unconfirmed) { Fabricate(:bulk_import, state: :unconfirmed, created_at: 10.seconds.ago) }
  let!(:recent_ongoing)  { Fabricate(:bulk_import, state: :in_progress, created_at: 20.minutes.ago) }
  let!(:recent_finished) { Fabricate(:bulk_import, state: :finished, created_at: 1.day.ago) }
  let!(:old_finished)    { Fabricate(:bulk_import, state: :finished, created_at: 2.months.ago) }

  describe '#perform' do
    it 'cleans up the expected imports' do
      expect { subject.perform }.to change { BulkImport.all.pluck(:id) }.from([old_unconfirmed, new_unconfirmed, recent_ongoing, recent_finished, old_finished].map(&:id)).to([new_unconfirmed, recent_ongoing, recent_finished].map(&:id))
    end
  end
end