Improve domain discard

- Extract rake task domain:discard
- Remove background job when keeping a domain

#790
This commit is contained in:
Artur Beljajev 2018-04-08 00:36:00 +03:00
parent 00a30fc019
commit e776d09f9d
10 changed files with 104 additions and 46 deletions

View file

@ -871,22 +871,6 @@ RSpec.describe Domain do
end
end
describe '::delete_candidates', db: true do
before :example do
travel_to Time.zone.parse('05.07.2010 00:00')
create(:zone, origin: 'ee')
create(:domain, id: 1, delete_at: Time.zone.parse('04.07.2010 23:59'))
create(:domain, id: 2, delete_at: Time.zone.parse('05.07.2010 00:00'))
create(:domain, id: 3, delete_at: Time.zone.parse('05.07.2010 00:01'))
end
it 'returns domains with delete time in the past' do
expect(described_class.delete_candidates.ids).to eq([1])
end
end
describe '::uses_zone?', db: true do
let!(:zone) { create(:zone, origin: 'domain.tld') }