diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-08-29 14:50:01 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-09-19 12:48:06 -0700 |
commit | da4cd4d981d8500271ea25e998faffe105e6b01c (patch) | |
tree | c632da29b7b7b190527821117e7623c73186cb49 /spec/unit/provider/dsc_script_spec.rb | |
parent | 4a6714e157511ff13e32f730346530d5fa5c9184 (diff) | |
download | chef-da4cd4d981d8500271ea25e998faffe105e6b01c.tar.gz |
Added test for #generate_description in provider/dsc_script_spec
Diffstat (limited to 'spec/unit/provider/dsc_script_spec.rb')
-rw-r--r-- | spec/unit/provider/dsc_script_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/provider/dsc_script_spec.rb b/spec/unit/provider/dsc_script_spec.rb index ff2c7cf3c0..3f8006e594 100644 --- a/spec/unit/provider/dsc_script_spec.rb +++ b/spec/unit/provider/dsc_script_spec.rb @@ -117,5 +117,25 @@ describe Chef::Provider::DscScript do resource.should_not be_updated end end + + describe '#generate_description' do + it 'removes the resource name from the beginning of any log line from the LCM' do + dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resourcename', true, ['resourcename doing something', 'lastline']) + provider.instance_variable_set('@dsc_resources_info', [dsc_resource_info]) + provider.send(:generate_description)[1].should match(/converge DSC resource resourcename by doing something/) + end + + it 'ignores the last line' do + dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resourcename', true, ['resourcename doing something', 'lastline']) + provider.instance_variable_set('@dsc_resources_info', [dsc_resource_info]) + provider.send(:generate_description)[1].should_not match(/lastline/) + end + + it 'reports a dsc resource has not been changed if the LCM reported no change was required' do + dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resourcename', false, ['resourcename does nothing', 'lastline']) + provider.instance_variable_set('@dsc_resources_info', [dsc_resource_info]) + provider.send(:generate_description)[1].should match(/converge DSC resource resourcename by doing nothing/) + end + end end |