diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-11 12:08:10 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-11 12:08:10 +0000 |
commit | b86f474bf51e20d2db4cf0895d0a8e0894e31c08 (patch) | |
tree | 061d2a4c749924f5a35fe6199dd1d8982c4b0b27 /spec/helpers/container_expiration_policies_helper_spec.rb | |
parent | 6b8040dc25fdc5fe614c3796a147517dd50bc7d8 (diff) | |
download | gitlab-ce-b86f474bf51e20d2db4cf0895d0a8e0894e31c08.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers/container_expiration_policies_helper_spec.rb')
-rw-r--r-- | spec/helpers/container_expiration_policies_helper_spec.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/helpers/container_expiration_policies_helper_spec.rb b/spec/helpers/container_expiration_policies_helper_spec.rb new file mode 100644 index 00000000000..3eb1234d82b --- /dev/null +++ b/spec/helpers/container_expiration_policies_helper_spec.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe ContainerExpirationPoliciesHelper do + describe '#keep_n_options' do + it 'returns keep_n options formatted for dropdown usage' do + expected_result = [ + { key: 1, label: '1 tag per image name' }, + { key: 5, label: '5 tags per image name' }, + { key: 10, label: '10 tags per image name' }, + { key: 25, label: '25 tags per image name' }, + { key: 50, label: '50 tags per image name' }, + { key: 100, label: '100 tags per image name' } + ] + + expect(helper.keep_n_options).to eq(expected_result) + end + end + + describe '#cadence_options' do + it 'returns cadence options formatted for dropdown usage' do + expected_result = [ + { key: '1d', label: 'Every day' }, + { key: '7d', label: 'Every week' }, + { key: '14d', label: 'Every two weeks' }, + { key: '1month', label: 'Every month' }, + { key: '3month', label: 'Every three months' } + ] + + expect(helper.cadence_options).to eq(expected_result) + end + end + + describe '#older_than_options' do + it 'returns older_than options formatted for dropdown usage' do + expected_result = [ + { key: '7d', label: '7 days until tags are automatically removed' }, + { key: '14d', label: '14 days until tags are automatically removed' }, + { key: '30d', label: '30 days until tags are automatically removed' }, + { key: '90d', label: '90 days until tags are automatically removed' } + ] + + expect(helper.older_than_options).to eq(expected_result) + end + end +end |