blob: 24efd08c855b75a6ca3a238b78a3de7a0841ee65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Ci::Config::Entry::Tags do
let(:entry) { described_class.new(config) }
describe 'validation' do
context 'when tags config value is correct' do
let(:config) { %w[tag1 tag2] }
describe '#value' do
it 'returns tags configuration' do
expect(entry.value).to eq config
end
end
describe '#valid?' do
it 'is valid' do
expect(entry).to be_valid
end
end
end
context 'when entry value is not correct' do
describe '#errors' do
context 'when tags config is not an array of strings' do
let(:config) { [1, 2] }
it 'reports error' do
expect(entry.errors)
.to include 'tags config should be an array of strings'
end
end
context 'when tags limit is reached' do
let(:config) { Array.new(50) { |i| "tag-#{i}" } }
it 'reports error' do
expect(entry.errors)
.to include "tags config must be less than the limit of #{described_class::TAGS_LIMIT} tags"
end
end
end
end
end
end
|