Commit 3a355bb3 authored by Krasimir Angelov's avatar Krasimir Angelov
parent b3a3357d
......@@ -17,7 +17,7 @@ module Gitlab
attributes ALLOWED_KEYS
validations do
validates :config, type: Hash, allowed_keys: ALLOWED_KEYS
validates :config, type: Hash, allowed_keys: ALLOWED_KEYS, required_keys: ALLOWED_KEYS
validates :name, presence: true, type: String
validates :path, presence: true, type: String
end
......
......@@ -38,12 +38,22 @@ describe Gitlab::Ci::Config::Entry::Vault::Engine do
end
end
context 'when name is not present' do
context 'when name and path are missing' do
let(:config) { {} }
it 'reports error' do
expect(entry.errors)
.to include 'engine name can\'t be blank'
expect(entry.errors).to include 'engine config missing required keys: name, path'
end
end
context 'when name and path are blank' do
let(:config) { { name: '', path: '' } }
it 'reports error' do
aggregate_failures do
expect(entry.errors).to include 'engine name can\'t be blank'
expect(entry.errors).to include 'engine path can\'t be blank'
end
end
end
end
......
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