diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e69d11d8..ba2ee5e6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -31,7 +31,8 @@ c.before :each do # set to strictest setting for testing # by default Puppet runs at warning level - Puppet.settings[:strict] = :warning + # newer versions of Puppet remove :strict + Puppet.settings[:strict] = :warning if Puppet.settings.include?(:strict) end end diff --git a/spec/unit/puppet_x/sql_connection_spec.rb b/spec/unit/puppet_x/sql_connection_spec.rb index cefce388..efffdfa8 100644 --- a/spec/unit/puppet_x/sql_connection_spec.rb +++ b/spec/unit/puppet_x/sql_connection_spec.rb @@ -24,12 +24,13 @@ def stub_connection @connection.stubs(:Open).with('Provider=SQLNCLI11;Initial Catalog=master;Application Name=Puppet;Data Source=.;DataTypeComptibility=80;User ID=sa;Password=Pupp3t1@') end it 'should not raise an error but populate has_errors with message' do - @connection.Errors.stubs(:count).returns(1) - @connection.Errors.stubs(:Description).returns("SQL Error in Connection") + @connection.Errors.stubs(:count).returns(2) + @connection.expects(:Errors).with(0).returns(stub( { :Description => "SQL Error in Connection" })) + @connection.expects(:Errors).with(1).returns(stub( { :Description => "Rowdy Roddy Piper" })) expect { result = subject.open_and_run_command('whacka whacka whacka', config) expect(result.exitstatus).to eq(1) - expect(result.error_message).to eq('SQL Error in Connection') + expect(result.error_message).to eq("SQL Error in Connection\nRowdy Roddy Piper") }.to_not raise_error(Exception) end