2020-11-24 15:15:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe PagesRemoveWorker do
|
2021-03-11 19:13:27 +05:30
|
|
|
let(:project) { create(:project, path: "my.project")}
|
|
|
|
let!(:domain) { create(:pages_domain, project: project) }
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
subject { described_class.new.perform(project.id) }
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
before do
|
|
|
|
project.mark_pages_as_deployed
|
|
|
|
end
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
it 'deletes published pages' do
|
2021-03-11 19:13:27 +05:30
|
|
|
expect(project.pages_deployed?).to be(true)
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
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-03-11 19:13:27 +05:30
|
|
|
expect(project.reload.pages_deployed?).to be(false)
|
2020-11-24 15:15:51 +05:30
|
|
|
end
|
|
|
|
end
|