Commit 915e6aa7 authored by lauraMon's avatar lauraMon

Removes presence validation from cache config

parent 3a5369e1
...@@ -17,8 +17,6 @@ module Gitlab ...@@ -17,8 +17,6 @@ module Gitlab
MULTIPLE_CACHE_LIMIT = 4 MULTIPLE_CACHE_LIMIT = 4
validations do validations do
validates :config, presence: true
validate do validate do
unless config.is_a?(Hash) || config.is_a?(Array) unless config.is_a?(Hash) || config.is_a?(Array)
errors.add(:config, 'can only be a Hash or an Array') errors.add(:config, 'can only be a Hash or an Array')
......
...@@ -13,6 +13,14 @@ RSpec.describe Gitlab::Ci::Config::Entry::Cache do ...@@ -13,6 +13,14 @@ RSpec.describe Gitlab::Ci::Config::Entry::Cache do
end end
describe '#valid?' do describe '#valid?' do
context 'with an empty hash as cache' do
let(:config) { {} }
it 'is valid' do
expect(entry).to be_valid
end
end
context 'when configuration is valid with a single cache' do context 'when configuration is valid with a single cache' do
let(:config) { { key: 'key', paths: ["logs/"], untracked: true } } let(:config) { { key: 'key', paths: ["logs/"], untracked: true } }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment