diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-24 15:12:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-24 15:12:57 +0300 |
commit | e40c68997d44209aed2baf3a8ec6be9ae99fb0b5 (patch) | |
tree | d5c7fd65b398a5857e27b9ae641b9a9435d971e5 /spec/models | |
parent | 563c8efdee39233f80f4dc7b20b38d417b26f055 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/concerns/ci/has_deployment_name_spec.rb | 34 | ||||
-rw-r--r-- | spec/models/namespace/root_storage_statistics_spec.rb | 2 |
2 files changed, 35 insertions, 1 deletions
diff --git a/spec/models/concerns/ci/has_deployment_name_spec.rb b/spec/models/concerns/ci/has_deployment_name_spec.rb new file mode 100644 index 00000000000..8c7338638b1 --- /dev/null +++ b/spec/models/concerns/ci/has_deployment_name_spec.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Ci::HasDeploymentName do + describe 'deployment_name?' do + let(:build) { create(:ci_build) } + + subject { build.branch? } + + it 'does detect deployment names' do + build.name = 'deployment' + + expect(build.deployment_name?).to be_truthy + end + + it 'does detect partial deployment names' do + build.name = 'do a really cool deploy' + + expect(build.deployment_name?).to be_truthy + end + + it 'does not detect non-deployment names' do + build.name = 'testing' + + expect(build.deployment_name?).to be_falsy + end + + it 'is case insensitive' do + build.name = 'DEPLOY' + expect(build.deployment_name?).to be_truthy + end + end +end diff --git a/spec/models/namespace/root_storage_statistics_spec.rb b/spec/models/namespace/root_storage_statistics_spec.rb index 11852828eab..c399a0084fb 100644 --- a/spec/models/namespace/root_storage_statistics_spec.rb +++ b/spec/models/namespace/root_storage_statistics_spec.rb @@ -178,7 +178,7 @@ RSpec.describe Namespace::RootStorageStatistics, type: :model do snippets = create_list(:personal_snippet, 3, :repository, author: user) snippets.each { |s| s.statistics.refresh! } - total_personal_snippets_size = snippets.map { |s| s.statistics.repository_size }.sum + total_personal_snippets_size = snippets.sum { |s| s.statistics.repository_size } root_storage_statistics.recalculate! |