summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2017-08-17 11:36:58 +0100
committerNick Thomas <nick@gitlab.com>2017-08-17 11:44:09 +0100
commitc9856e53ea05374dcab0a591bd0352d321120b68 (patch)
tree952573906ee0e2b326adaa9e38a7daa9aed163ea /spec
parent0de85b53194f582e8fc3267f14b7a5038440e401 (diff)
downloadgitlab-ce-c9856e53ea05374dcab0a591bd0352d321120b68.tar.gz
Run remove_pages in a run_after_commit block
Diffstat (limited to 'spec')
-rw-r--r--spec/models/project_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 361a4c022ca..e1d64986a76 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -2313,6 +2313,7 @@ describe Project do
describe '#remove_pages' do
let(:project) { create(:project) }
+ let(:namespace) { project.namespace }
let(:pages_path) { project.pages_path }
around do |example|
@@ -2324,6 +2325,14 @@ describe Project do
end
end
+ it 'removes the pages directory' do
+ expect_any_instance_of(Projects::UpdatePagesConfigurationService).to receive(:execute)
+ expect_any_instance_of(Gitlab::PagesTransfer).to receive(:rename_project).and_return(true)
+ expect(PagesWorker).to receive(:perform_in).with(5.minutes, :remove, namespace.full_path, anything)
+
+ project.remove_pages
+ end
+
it 'is a no-op when there is no namespace' do
project.update_column(:namespace_id, nil)
@@ -2332,6 +2341,12 @@ describe Project do
project.remove_pages
end
+
+ it 'is run when the project is destroyed' do
+ expect(project).to receive(:remove_pages).and_call_original
+
+ project.destroy
+ end
end
describe '#forks_count' do