BigW Consortium Gitlab

Commit 5ef104df by Grzegorz Bizon

Improve Ci config loader by changing method signature

parent fa097c67
......@@ -5,7 +5,7 @@ module Gitlab
def initialize(config)
loader = Loader.new(config)
@config = loader.load
@config = loader.load!
end
def to_hash
......
......@@ -12,7 +12,7 @@ module Gitlab
@config.is_a?(Hash)
end
def load
def load!
unless valid?
raise FormatError, 'Invalid configuration format'
end
......
......@@ -12,9 +12,9 @@ describe Gitlab::Ci::Config::Loader do
end
end
describe '#load' do
describe '#load!' do
it 'returns a valid hash' do
expect(loader.load).to eq(image: 'ruby:2.2')
expect(loader.load!).to eq(image: 'ruby:2.2')
end
end
end
......@@ -28,9 +28,9 @@ describe Gitlab::Ci::Config::Loader do
end
end
describe '#load' do
describe '#load!' do
it 'raises error' do
expect { loader.load }.to raise_error(
expect { loader.load! }.to raise_error(
Gitlab::Ci::Config::Loader::FormatError,
'Invalid configuration format'
)
......
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