Skip to content

(maint) Spec fixes #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 4 additions & 3 deletions spec/unit/puppet_x/sql_connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down