2020-08-25 20:10:31 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe PagesRemoveWorker do
|
2021-02-08 13:09:49 -05:00
|
|
|
let(:project) { create(:project, path: "my.project")}
|
|
|
|
let!(:domain) { create(:pages_domain, project: project) }
|
|
|
|
|
2020-08-25 20:10:31 -04:00
|
|
|
subject { described_class.new.perform(project.id) }
|
|
|
|
|
2021-02-08 13:09:49 -05:00
|
|
|
before do
|
|
|
|
project.mark_pages_as_deployed
|
|
|
|
end
|
|
|
|
|
2020-08-25 20:10:31 -04:00
|
|
|
it 'deletes published pages' do
|
2021-02-08 13:09:49 -05:00
|
|
|
expect(project.pages_deployed?).to be(true)
|
|
|
|
|
2020-08-25 20:10:31 -04:00
|
|
|
expect_any_instance_of(Gitlab::PagesTransfer).to receive(:rename_project).and_return true
|
|
|
|
expect(PagesWorker).to receive(:perform_in).with(5.minutes, :remove, project.namespace.full_path, anything)
|
|
|
|
|
|
|
|
subject
|
|
|
|
|
2021-02-08 13:09:49 -05:00
|
|
|
expect(project.reload.pages_deployed?).to be(false)
|
2020-08-25 20:10:31 -04:00
|
|
|
end
|
|
|
|
end
|