diff options
-rw-r--r-- | lib/gitlab/ci/config.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/config/loader.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/config/loader_spec.rb | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/gitlab/ci/config.rb b/lib/gitlab/ci/config.rb index b6ce791c0ff..ffe633d4b63 100644 --- a/lib/gitlab/ci/config.rb +++ b/lib/gitlab/ci/config.rb @@ -5,7 +5,7 @@ module Gitlab def initialize(config) loader = Loader.new(config) - @config = loader.load + @config = loader.load! end def to_hash diff --git a/lib/gitlab/ci/config/loader.rb b/lib/gitlab/ci/config/loader.rb index ed9cc16702c..dbf6eb0edbe 100644 --- a/lib/gitlab/ci/config/loader.rb +++ b/lib/gitlab/ci/config/loader.rb @@ -12,7 +12,7 @@ module Gitlab @config.is_a?(Hash) end - def load + def load! unless valid? raise FormatError, 'Invalid configuration format' end diff --git a/spec/lib/gitlab/ci/config/loader_spec.rb b/spec/lib/gitlab/ci/config/loader_spec.rb index 6f1a10085dd..2d44b1f60f1 100644 --- a/spec/lib/gitlab/ci/config/loader_spec.rb +++ b/spec/lib/gitlab/ci/config/loader_spec.rb @@ -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' ) |