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>2023-10-19 15:57:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-19 15:57:54 +0300
commit419c53ec62de6e97a517abd5fdd4cbde3a942a34 (patch)
tree1f43a548b46bca8a5fb8fe0c31cef1883d49c5b6 /spec/models/container_registry/protection/rule_spec.rb
parent1da20d9135b3ad9e75e65b028bffc921aaf8deb7 (diff)
Add latest changes from gitlab-org/gitlab@16-5-stable-eev16.5.0-rc42
Diffstat (limited to 'spec/models/container_registry/protection/rule_spec.rb')
-rw-r--r--spec/models/container_registry/protection/rule_spec.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/models/container_registry/protection/rule_spec.rb b/spec/models/container_registry/protection/rule_spec.rb
new file mode 100644
index 00000000000..9f162736efd
--- /dev/null
+++ b/spec/models/container_registry/protection/rule_spec.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe ContainerRegistry::Protection::Rule, type: :model, feature_category: :container_registry do
+ it_behaves_like 'having unique enum values'
+
+ describe 'relationships' do
+ it { is_expected.to belong_to(:project).inverse_of(:container_registry_protection_rules) }
+ end
+
+ describe 'enums' do
+ it {
+ is_expected.to(
+ define_enum_for(:push_protected_up_to_access_level)
+ .with_values(
+ developer: Gitlab::Access::DEVELOPER,
+ maintainer: Gitlab::Access::MAINTAINER,
+ owner: Gitlab::Access::OWNER
+ )
+ .with_prefix(:push_protected_up_to)
+ )
+ }
+
+ it {
+ is_expected.to(
+ define_enum_for(:delete_protected_up_to_access_level)
+ .with_values(
+ developer: Gitlab::Access::DEVELOPER,
+ maintainer: Gitlab::Access::MAINTAINER,
+ owner: Gitlab::Access::OWNER
+ )
+ .with_prefix(:delete_protected_up_to)
+ )
+ }
+ end
+
+ describe 'validations' do
+ subject { build(:container_registry_protection_rule) }
+
+ describe '#container_path_pattern' do
+ it { is_expected.to validate_presence_of(:container_path_pattern) }
+ it { is_expected.to validate_length_of(:container_path_pattern).is_at_most(255) }
+ end
+
+ describe '#delete_protected_up_to_access_level' do
+ it { is_expected.to validate_presence_of(:delete_protected_up_to_access_level) }
+ end
+
+ describe '#push_protected_up_to_access_level' do
+ it { is_expected.to validate_presence_of(:push_protected_up_to_access_level) }
+ end
+ end
+end