diff --git a/lib/jerry.rb b/lib/jerry.rb index ccb552c..33beeea 100644 --- a/lib/jerry.rb +++ b/lib/jerry.rb @@ -29,13 +29,13 @@ def initialize(*configs) # @param key what to provide # @return an insance of the sepcified key provided by one of the configs - # @raise [Jerry::InstanciationError] if can't instanciate key + # @raise [Jerry::InstantiationError] if can't instanciate key def [](key) config = @configs.find { |conf| conf.knows? key } if config config[key] else - fail Jerry::InstanciationError, "Can't find #{key} in any config" + fail Jerry::InstantiationError, "Can't find #{key} in any config" end end end diff --git a/lib/jerry/config.rb b/lib/jerry/config.rb index ddf7fec..b1f7d4e 100644 --- a/lib/jerry/config.rb +++ b/lib/jerry/config.rb @@ -47,11 +47,11 @@ def [](key) if provider provider.call @jerry, self else - fail InstanciationError, + fail InstantiationError, "Failed to instanciate #{key}. Can't find provider for it" end rescue RuntimeError - raise InstanciationError, "Provider for #{key} raised an error" + raise InstantiationError, "Provider for #{key} raised an error" end # @return true if this config can provide the given key, false otherwise diff --git a/lib/jerry/errors.rb b/lib/jerry/errors.rb index a1859be..aee2b36 100644 --- a/lib/jerry/errors.rb +++ b/lib/jerry/errors.rb @@ -12,5 +12,5 @@ def initialize(message = nil) end # Failed to instanciate a class - class InstanciationError < Jerry::Error; end + class InstantiationError < Jerry::Error; end end diff --git a/spec/config_spec.rb b/spec/config_spec.rb index f912933..a4d4d99 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -76,7 +76,7 @@ end it 'should fail when provider is missing' do - expect { config[:not_there] }.to raise_error(Jerry::InstanciationError) + expect { config[:not_there] }.to raise_error(Jerry::InstantiationError) end it 'should wrap errors from the provider' do @@ -86,7 +86,7 @@ config_klass.providers[:failing] = provider expect { config[:failing] } - .to raise_error(Jerry::InstanciationError) do |e| + .to raise_error(Jerry::InstantiationError) do |e| expect(e.cause.message).to eq 'something blew up' end end diff --git a/spec/jerry_spec.rb b/spec/jerry_spec.rb index 40b4f31..3c6e9dd 100644 --- a/spec/jerry_spec.rb +++ b/spec/jerry_spec.rb @@ -78,7 +78,7 @@ def double_config(name, fields = {}) configs = 3.times.map { double_config 'some config', knows?: false } jerry = Jerry.new(*configs) - expect { jerry[:not_there] }.to raise_error(Jerry::InstanciationError) + expect { jerry[:not_there] }.to raise_error(Jerry::InstantiationError) end end end