Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-11 15:08:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-11 15:08:54 +0300
commit0526dc1e681db465189573d0931610c049206106 (patch)
tree8d4241fc85ea1041b259a8c1ec4d4656adb26188 /spec/models
parenta64fb464b4081ec468da3fec97dfdede1fbd55e7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/container_expiration_policy_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/container_expiration_policy_spec.rb b/spec/models/container_expiration_policy_spec.rb
index c22362ed5d4..7d9c7638897 100644
--- a/spec/models/container_expiration_policy_spec.rb
+++ b/spec/models/container_expiration_policy_spec.rb
@@ -37,6 +37,37 @@ RSpec.describe ContainerExpirationPolicy, type: :model do
it { is_expected.to allow_value(nil).for(:keep_n) }
it { is_expected.not_to allow_value('foo').for(:keep_n) }
end
+
+ context 'with a set of regexps' do
+ valid_regexps = %w[master .* v.+ v10.1.* (?:v.+|master|release)]
+ invalid_regexps = ['[', '(?:v.+|master|release']
+
+ valid_regexps.each do |valid_regexp|
+ it { is_expected.to allow_value(valid_regexp).for(:name_regex) }
+ it { is_expected.to allow_value(valid_regexp).for(:name_regex_keep) }
+ end
+
+ invalid_regexps.each do |invalid_regexp|
+ it { is_expected.not_to allow_value(invalid_regexp).for(:name_regex) }
+ it { is_expected.not_to allow_value(invalid_regexp).for(:name_regex_keep) }
+ end
+
+ context 'with a disabled container expiration policy' do
+ let_it_be(:container_expiration_policy) { create(:container_expiration_policy, :disabled) }
+
+ subject { container_expiration_policy }
+
+ valid_regexps.each do |valid_regexp|
+ it { is_expected.to allow_value(valid_regexp).for(:name_regex) }
+ it { is_expected.to allow_value(valid_regexp).for(:name_regex_keep) }
+ end
+
+ invalid_regexps.each do |invalid_regexp|
+ it { is_expected.to allow_value(invalid_regexp).for(:name_regex) }
+ it { is_expected.to allow_value(invalid_regexp).for(:name_regex_keep) }
+ end
+ end
+ end
end
describe '.preloaded' do