summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
Diffstat (limited to 'features')
-rw-r--r--features/mixlib_config.feature14
-rw-r--r--features/steps/config_steps.rb24
-rw-r--r--features/support/config_it.rb4
3 files changed, 36 insertions, 6 deletions
diff --git a/features/mixlib_config.feature b/features/mixlib_config.feature
index 6defc7a..35432b7 100644
--- a/features/mixlib_config.feature
+++ b/features/mixlib_config.feature
@@ -4,12 +4,20 @@ Feature: Configure an application
I want to utilize a simple configuration object
Scenario: Set a configuration option to a string
- Given a configuration class
- When I set 'foo' to 'bar'
+ Given a configuration class 'ConfigIt'
+ When I set 'foo' to 'bar' in configuration class 'ConfigIt'
Then config option 'foo' is 'bar'
+
+Scenario: Set the same configuration option to different strings for two configuration classes
+ Given a configuration class 'ConfigIt'
+ And a configuration class 'ConfigItToo'
+ When I set 'foo' to 'bar' in configuration class 'ConfigIt'
+ And I set 'foo' to 'bar2' in configuration class 'ConfigItToo'
+ Then in configuration class 'ConfigItToo' config option 'foo' is 'bar2'
+ And in configuration class 'ConfigIt' config option 'foo' is 'bar'
Scenario: Set a configuration option to an Array
- Given a configuration class
+ Given a configuration class 'ConfigIt'
When I set 'foo' to:
|key|
|bar|
diff --git a/features/steps/config_steps.rb b/features/steps/config_steps.rb
index 867702d..0785af3 100644
--- a/features/steps/config_steps.rb
+++ b/features/steps/config_steps.rb
@@ -16,17 +16,35 @@
# limitations under the License.
#
-Given /^a configuration class$/ do
+Given /^a configuration class '(.+)'$/ do |classname|
end
-When /^I set '(.+)' to '(.+)'$/ do |key, value|
- ConfigIt[key.to_sym] = value
+When /^I set '(.+)' to '(.+)' in configuration class '(.+)'$/ do |key, value, classname|
+
+ #ConfigIt[key.to_sym] = value
+ if classname == 'ConfigIt'
+ ConfigIt[key.to_sym] = value
+ elsif classname == 'ConfigItToo'
+ ConfigItToo[key.to_sym] = value
+ else
+ raise ArgumentError, "configuration class must be ConfigIt or ConfigItToo"
+ end
end
Then /^config option '(.+)' is '(.+)'$/ do |key, value|
ConfigIt[key.to_sym].should == value
end
+Then /^in configuration class '(.+)' config option '(.+)' is '(.+)'$/ do |classname, key, value|
+ if classname == 'ConfigIt'
+ ConfigIt[key.to_sym].should == value
+ elsif classname == 'ConfigItToo'
+ ConfigItToo[key.to_sym].should == value
+ else
+ raise ArgumentError, "configuration class must be ConfigIt or ConfigItToo"
+ end
+end
+
When /^I set '(.+)' to:$/ do |key, foo_table|
ConfigIt[key.to_sym] = Array.new
foo_table.hashes.each do |hash|
diff --git a/features/support/config_it.rb b/features/support/config_it.rb
index 28ea454..c872e33 100644
--- a/features/support/config_it.rb
+++ b/features/support/config_it.rb
@@ -21,4 +21,8 @@ require 'mixlib/config'
class ConfigIt
extend Mixlib::Config
+end
+
+class ConfigItToo
+ extend Mixlib::Config
end \ No newline at end of file