Skip to content

Commit

Permalink
Renamed InstanciationError to InstantiationError
Browse files Browse the repository at this point in the history
It's a typo
  • Loading branch information
Boris Bera committed Jul 12, 2015
1 parent 0473694 commit 6ae8558
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/jerry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions lib/jerry/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/jerry/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions spec/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/jerry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6ae8558

Please sign in to comment.