summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-21 03:08:37 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-21 03:08:37 +0000
commit2399724614f3c4dcf3059038d997193830de93ee (patch)
tree3315c4453ef3efb5c1162911753436cad4f3e57d /spec/services
parent6755df108b123ecc8ae330d7c7bf2f04fbf36a81 (diff)
downloadgitlab-ce-2399724614f3c4dcf3059038d997193830de93ee.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/projects/update_pages_service_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb
index 714256d9b08..e8db243c472 100644
--- a/spec/services/projects/update_pages_service_spec.rb
+++ b/spec/services/projects/update_pages_service_spec.rb
@@ -176,6 +176,35 @@ describe Projects::UpdatePagesService do
describe 'maximum pages artifacts size' do
let(:metadata) { spy('metadata') }
+ shared_examples 'pages size limit is' do |size_limit|
+ context "when size is below the limit" do
+ before do
+ allow(metadata).to receive(:total_size).and_return(size_limit - 1.megabyte)
+ end
+
+ it 'updates pages correctly' do
+ subject.execute
+
+ expect(deploy_status.description).not_to be_present
+ expect(project.pages_metadatum).to be_deployed
+ end
+ end
+
+ context "when size is above the limit" do
+ before do
+ allow(metadata).to receive(:total_size).and_return(size_limit + 1.megabyte)
+ end
+
+ it 'limits the maximum size of gitlab pages' do
+ subject.execute
+
+ expect(deploy_status.description)
+ .to match(/artifacts for pages are too large/)
+ expect(deploy_status).to be_script_failure
+ end
+ end
+ end
+
before do
file = fixture_file_upload('spec/fixtures/pages.zip')
metafile = fixture_file_upload('spec/fixtures/pages.zip.meta')