Commit 5ef104df authored by Grzegorz Bizon's avatar Grzegorz Bizon

Improve Ci config loader by changing method signature

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