diff options
Diffstat (limited to 'spec/unit/util/dsc/local_configuration_manager_spec.rb')
-rw-r--r-- | spec/unit/util/dsc/local_configuration_manager_spec.rb | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/spec/unit/util/dsc/local_configuration_manager_spec.rb b/spec/unit/util/dsc/local_configuration_manager_spec.rb index 1cff9e445b..eb860b5c30 100644 --- a/spec/unit/util/dsc/local_configuration_manager_spec.rb +++ b/spec/unit/util/dsc/local_configuration_manager_spec.rb @@ -16,12 +16,12 @@ # limitations under the License. # -require 'chef' -require 'chef/util/dsc/local_configuration_manager' +require "chef" +require "chef/util/dsc/local_configuration_manager" describe Chef::Util::DSC::LocalConfigurationManager do - let(:lcm) { Chef::Util::DSC::LocalConfigurationManager.new(nil, 'tmp') } + let(:lcm) { Chef::Util::DSC::LocalConfigurationManager.new(nil, "tmp") } let(:normal_lcm_output) { <<-EOH logtype: [machinename]: LCM: [ Start Set ] @@ -50,12 +50,12 @@ EOH double("LCM cmdlet status", :stderr => lcm_standard_error, :return_value => lcm_standard_output, :succeeded? => lcm_cmdlet_success) } - describe 'test_configuration method invocation' do - context 'when interacting with the LCM using a PowerShell cmdlet' do + describe "test_configuration method invocation" do + context "when interacting with the LCM using a PowerShell cmdlet" do before(:each) do allow(lcm).to receive(:run_configuration_cmdlet).and_return(lcm_status) end - context 'that returns successfully' do + context "that returns successfully" do before(:each) do allow(lcm).to receive(:run_configuration_cmdlet).and_return(lcm_status) end @@ -64,16 +64,16 @@ EOH let(:lcm_standard_error) { nil } let(:lcm_cmdlet_success) { true } - it 'should successfully return resource information for normally formatted output when cmdlet the cmdlet succeeds' do - test_configuration_result = lcm.test_configuration('config', {}) + it "should successfully return resource information for normally formatted output when cmdlet the cmdlet succeeds" do + test_configuration_result = lcm.test_configuration("config", {}) expect(test_configuration_result.class).to be(Array) expect(test_configuration_result.length).to be > 0 expect(Chef::Log).not_to receive(:warn) end end - context 'that fails due to missing what-if switch in DSC resource cmdlet implementation' do - let(:lcm_standard_output) { '' } + context "that fails due to missing what-if switch in DSC resource cmdlet implementation" do + let(:lcm_standard_output) { "" } let(:lcm_standard_error) { no_whatif_lcm_output } let(:lcm_cmdlet_success) { false } @@ -81,58 +81,58 @@ EOH expect(lcm.send(:whatif_not_supported?, no_whatif_lcm_output)).to be_truthy end - it 'should should return a (possibly empty) array of ResourceInfo instances' do + it "should should return a (possibly empty) array of ResourceInfo instances" do expect(Chef::Log).to receive(:warn).at_least(:once) expect(lcm).to receive(:whatif_not_supported?).and_call_original test_configuration_result = nil - expect {test_configuration_result = lcm.test_configuration('config', {})}.not_to raise_error + expect {test_configuration_result = lcm.test_configuration("config", {})}.not_to raise_error expect(test_configuration_result.class).to be(Array) end end - context 'that fails due to a DSC resource not being imported before StartDSCConfiguration -whatif is executed' do - let(:lcm_standard_output) { '' } + context "that fails due to a DSC resource not being imported before StartDSCConfiguration -whatif is executed" do + let(:lcm_standard_output) { "" } let(:lcm_standard_error) { dsc_resource_import_failure_output } let(:lcm_cmdlet_success) { false } - it 'should log a warning if the message is formatted as expected when a resource import failure occurs' do + it "should log a warning if the message is formatted as expected when a resource import failure occurs" do expect(Chef::Log).to receive(:warn).at_least(:once) expect(lcm).to receive(:dsc_module_import_failure?).and_call_original test_configuration_result = nil - expect {test_configuration_result = lcm.test_configuration('config', {})}.not_to raise_error + expect {test_configuration_result = lcm.test_configuration("config", {})}.not_to raise_error end - it 'should return a (possibly empty) array of ResourceInfo instances' do + it "should return a (possibly empty) array of ResourceInfo instances" do expect(Chef::Log).to receive(:warn).at_least(:once) test_configuration_result = nil - expect {test_configuration_result = lcm.test_configuration('config', {})}.not_to raise_error + expect {test_configuration_result = lcm.test_configuration("config", {})}.not_to raise_error expect(test_configuration_result.class).to be(Array) end end - context 'that fails due to an unknown PowerShell cmdlet error' do - let(:lcm_standard_output) { 'some output' } - let(:lcm_standard_error) { 'Abort, Retry, Fail?' } + context "that fails due to an unknown PowerShell cmdlet error" do + let(:lcm_standard_output) { "some output" } + let(:lcm_standard_error) { "Abort, Retry, Fail?" } let(:lcm_cmdlet_success) { false } - it 'should log a warning' do + it "should log a warning" do expect(Chef::Log).to receive(:warn).at_least(:once) expect(lcm).to receive(:dsc_module_import_failure?).and_call_original - expect {lcm.test_configuration('config', {})}.not_to raise_error + expect {lcm.test_configuration("config", {})}.not_to raise_error end end end - it 'should identify a correctly formatted error message as a resource import failure' do + it "should identify a correctly formatted error message as a resource import failure" do expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output)).to be(true) end - it 'should not identify an incorrectly formatted error message as a resource import failure' do - expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub('module', 'gibberish'))).to be(false) + it "should not identify an incorrectly formatted error message as a resource import failure" do + expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub("module", "gibberish"))).to be(false) end - it 'should not identify a message without a CimException reference as a resource import failure' do - expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub('CimException', 'ArgumentException'))).to be(false) + it "should not identify a message without a CimException reference as a resource import failure" do + expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub("CimException", "ArgumentException"))).to be(false) end end end |