summaryrefslogtreecommitdiff
path: root/spec/unit/util
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-02-08 09:10:01 -0800
committerJay Mundrawala <jdmundrawala@gmail.com>2015-02-08 09:10:01 -0800
commit8f8f018b3f5275ef900eea18a8f9b15dd724053e (patch)
tree2d1c78786ea49c3f7329a80941b79eaf78af3c86 /spec/unit/util
parentd9653b059537f8f1d7c4712cc05ad3037d84daba (diff)
downloadchef-8f8f018b3f5275ef900eea18a8f9b15dd724053e.tar.gz
Added unit tests for dsc configuration generator when imports are present
Diffstat (limited to 'spec/unit/util')
-rw-r--r--spec/unit/util/dsc/configuration_generator_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/util/dsc/configuration_generator_spec.rb b/spec/unit/util/dsc/configuration_generator_spec.rb
index cfcdb24093..80714a225d 100644
--- a/spec/unit/util/dsc/configuration_generator_spec.rb
+++ b/spec/unit/util/dsc/configuration_generator_spec.rb
@@ -167,5 +167,21 @@ describe Chef::Util::DSC::ConfigurationGenerator do
end
expect(found_configuration).to be_truthy
end
+ context "with imports" do
+ it "should import all resources when a module has an empty list" do
+ dsc = conf_man.send(:configuration_code, 'archive{}', 'hello', {'FooModule' => []})
+ expect(dsc).to match(/Import-DscResource -ModuleName FooModule\s*\n/)
+ end
+
+ it "should import all resources when a module has a list with *" do
+ dsc = conf_man.send(:configuration_code, 'archive{}', 'hello', {'FooModule' => ['FooResource', '*', 'BarResource']})
+ expect(dsc).to match(/Import-DscResource -ModuleName FooModule\s*\n/)
+ end
+
+ it "should import specific resources when a module has list without * that is not empty" do
+ dsc = conf_man.send(:configuration_code, 'archive{}', 'hello', {'FooModule' => ['FooResource', 'BarResource']})
+ expect(dsc).to match(/Import-DscResource -ModuleName FooModule -Name FooResource,BarResource/)
+ end
+ end
end
end