diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-18 15:07:53 +0300 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-02-01 01:53:56 +0300 |
commit | e9e8a2f60811c460d0bb850da2bb35ea43e35698 (patch) | |
tree | c12f1c59ef1a40b7046b2ef484a7abe2bcb09304 /spec | |
parent | 9ff381c492695bf9b76b27047bd0b38a70a4daac (diff) |
Asynchronously remove pages
Diffstat (limited to 'spec')
-rw-r--r-- | spec/workers/pages_worker_spec.rb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/spec/workers/pages_worker_spec.rb b/spec/workers/pages_worker_spec.rb index 158a4b3ba8d..85592154598 100644 --- a/spec/workers/pages_worker_spec.rb +++ b/spec/workers/pages_worker_spec.rb @@ -18,41 +18,48 @@ describe PagesWorker do it 'succeeds' do expect(project.pages_url).to be_nil - expect(worker.perform(build.id)).to be_truthy + expect(worker.deploy(build.id)).to be_truthy expect(project.pages_url).to_not be_nil end it 'limits pages size' do stub_application_setting(max_pages_size: 1) - expect(worker.perform(build.id)).to_not be_truthy + expect(worker.deploy(build.id)).to_not be_truthy end it 'removes pages after destroy' do + expect(PagesWorker).to receive(:perform_in) expect(project.pages_url).to be_nil - expect(worker.perform(build.id)).to be_truthy + expect(worker.deploy(build.id)).to be_truthy expect(project.pages_url).to_not be_nil project.destroy expect(Dir.exist?(project.public_pages_path)).to be_falsey end end + it 'fails to remove project pages when no pages is deployed' do + expect(PagesWorker).to_not receive(:perform_in) + expect(project.pages_url).to be_nil + project.destroy + end + it 'fails if no artifacts' do - expect(worker.perform(build.id)).to_not be_truthy + expect(worker.deploy(build.id)).to_not be_truthy end it 'fails for empty file fails' do build.update_attributes(artifacts_file: empty_file) - expect(worker.perform(build.id)).to_not be_truthy + expect(worker.deploy(build.id)).to_not be_truthy end it 'fails for invalid archive' do build.update_attributes(artifacts_file: invalid_file) - expect(worker.perform(build.id)).to_not be_truthy + expect(worker.deploy(build.id)).to_not be_truthy end it 'fails if sha on branch is not latest' do commit.update_attributes(sha: 'old_sha') build.update_attributes(artifacts_file: file) - expect(worker.perform(build.id)).to_not be_truthy + expect(worker.deploy(build.id)).to_not be_truthy end end |