summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-09-11 08:16:13 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-09-11 08:16:13 -0700
commit41ea64371a277894a2ecafe3f8b77780edb4ea2a (patch)
tree09e3573fcef0c10b0d4bc8ed052c987180349651
parentc41db69a4d58e247c812849fb5a8b185ba9e4e42 (diff)
downloadmixlib-config-41ea64371a277894a2ecafe3f8b77780edb4ea2a.tar.gz
Rename StrictModeError -> UnknownConfigOptionError
-rw-r--r--lib/mixlib/config.rb14
-rw-r--r--lib/mixlib/config/unknown_config_option_error.rb (renamed from lib/mixlib/config/strict_mode_error.rb)2
-rw-r--r--spec/mixlib/config_spec.rb14
3 files changed, 15 insertions, 15 deletions
diff --git a/lib/mixlib/config.rb b/lib/mixlib/config.rb
index 9d411df..08b1da9 100644
--- a/lib/mixlib/config.rb
+++ b/lib/mixlib/config.rb
@@ -20,7 +20,7 @@
require 'mixlib/config/version'
require 'mixlib/config/configurable'
-require 'mixlib/config/strict_mode_error'
+require 'mixlib/config/unknown_config_option_error'
module Mixlib
module Config
@@ -61,7 +61,7 @@ module Mixlib
# value:: The value of the config option
#
# === Raises
- # <StrictModeError>:: If the config option does not exist and strict mode is on.
+ # <UnknownConfigOptionError>:: If the config option does not exist and strict mode is on.
def [](config_option)
internal_get(config_option.to_sym)
end
@@ -76,7 +76,7 @@ module Mixlib
# value:: The new value of the config option
#
# === Raises
- # <StrictModeError>:: If the config option does not exist and strict mode is on.
+ # <UnknownConfigOptionError>:: If the config option does not exist and strict mode is on.
def []=(config_option, value)
internal_set(config_option, value)
end
@@ -221,7 +221,7 @@ module Mixlib
# Gets or sets strict mode. When strict mode is on, only values which
# were specified with configurable(), default() or writes_with() may be
# retrieved or set. Getting or setting anything else will cause
- # Mixlib::Config::StrictModeError to be thrown.
+ # Mixlib::Config::UnknownConfigOptionError to be thrown.
#
# If this is set to :warn, unknown values may be get or set, but a warning
# will be printed with Chef::Log.warn if this occurs.
@@ -275,7 +275,7 @@ module Mixlib
# value:: The value of the config option.
#
# === Raises
- # <StrictModeError>:: If the config option does not exist and strict mode is on.
+ # <UnknownConfigOptionError>:: If the config option does not exist and strict mode is on.
def method_missing(method_symbol, *args)
num_args = args.length
# Setting
@@ -308,7 +308,7 @@ module Mixlib
if config_strict_mode == :warn
Chef::Log.warn("Setting unsupported config value #{method_name}..")
elsif self.config_strict_mode
- raise StrictModeError, "Cannot set unsupported config value #{method_name}."
+ raise UnknownConfigOptionError, "Cannot set unsupported config value #{method_name}."
end
configuration[method_symbol] = value
end
@@ -326,7 +326,7 @@ module Mixlib
if config_strict_mode == :warn
Chef::Log.warn("Reading unsupported config value #{symbol}.")
elsif config_strict_mode
- raise StrictModeError, "Reading unsupported config value #{symbol}."
+ raise UnknownConfigOptionError, "Reading unsupported config value #{symbol}."
end
configuration[symbol]
end
diff --git a/lib/mixlib/config/strict_mode_error.rb b/lib/mixlib/config/unknown_config_option_error.rb
index 016bb01..83dd1da 100644
--- a/lib/mixlib/config/strict_mode_error.rb
+++ b/lib/mixlib/config/unknown_config_option_error.rb
@@ -18,7 +18,7 @@
module Mixlib
module Config
- class StrictModeError < StandardError
+ class UnknownConfigOptionError < StandardError
end
end
end
diff --git a/spec/mixlib/config_spec.rb b/spec/mixlib/config_spec.rb
index fd29efb..ac45b55 100644
--- a/spec/mixlib/config_spec.rb
+++ b/spec/mixlib/config_spec.rb
@@ -93,23 +93,23 @@ describe Mixlib::Config do
end
it "raises an error when you get an arbitrary config option with .y" do
- lambda { StrictClass.y }.should raise_error(Mixlib::Config::StrictModeError)
+ lambda { StrictClass.y }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
end
it "raises an error when you get an arbitrary config option with [:y]" do
- lambda { StrictClass[:y] }.should raise_error(Mixlib::Config::StrictModeError)
+ lambda { StrictClass[:y] }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
end
it "raises an error when you set an arbitrary config option with .y = 10" do
- lambda { StrictClass.y = 10 }.should raise_error(Mixlib::Config::StrictModeError)
+ lambda { StrictClass.y = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
end
it "raises an error when you get an arbitrary config option with .y 10" do
- lambda { StrictClass.y 10 }.should raise_error(Mixlib::Config::StrictModeError)
+ lambda { StrictClass.y 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
end
it "raises an error when you get an arbitrary config option with [:y] = 10" do
- lambda { StrictClass[:y] = 10 }.should raise_error(Mixlib::Config::StrictModeError)
+ lambda { StrictClass[:y] = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
end
end
@@ -429,7 +429,7 @@ describe Mixlib::Config do
end
it "The nested class does not allow you to set arbitrary config options" do
- lambda { StrictClass2.c.y = 10 }.should raise_error(Mixlib::Config::StrictModeError)
+ lambda { StrictClass2.c.y = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
end
end
@@ -442,7 +442,7 @@ describe Mixlib::Config do
end
it "The parent class does not allow you to set arbitrary config options" do
- lambda { StrictClass3.y = 10 }.should raise_error(Mixlib::Config::StrictModeError)
+ lambda { StrictClass3.y = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
end
it "The nested class allows you to set arbitrary config options" do