Skip to content

Commit a89119f

Browse files
committed
WIP - fixup with connection_string refactor
1 parent 3a158c1 commit a89119f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/puppet_x/sqlserver/sql_connection.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def get_connection_string(config)
3737
'Data Source' => 'localhost'
3838
}
3939
if config['instance'] !~ /^MSSQLSERVER$/i
40-
params['Data Source'] = "localhost\\#{config['instance']};"
40+
params['Data Source'] = "localhost\\#{config['instance']}"
4141
end
4242

4343
params.map { |k, v| "#{k}=#{v}" }.join(';')

spec/unit/puppet_x/sql_connection_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def stub_no_errors
2222
before :each do
2323
stub_connection
2424
@connection.stubs(:State).returns(0)
25-
@connection.stubs(:Open).with('Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;password=Pupp3t1@;Initial Catalog=master;Application Name=Puppet;Data Source=localhost;')
25+
@connection.stubs(:Open).with('Provider=SQLOLEDB.1;User ID=sa;Password=Pupp3t1@;Initial Catalog=master;Application Name=Puppet;Data Source=localhost')
2626
end
2727
it 'should not raise an error but populate has_errors with message' do
2828
subject.stubs(:win32_exception).returns(Exception)
@@ -48,11 +48,11 @@ def stub_no_errors
4848
@connection.stubs(:State).returns(0)
4949
end
5050
it 'should not add MSSQLSERVER to connection string' do
51-
@connection.stubs(:Open).with('Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;password=Pupp3t1@;Initial Catalog=master;Application Name=Puppet;Data Source=localhost;')
51+
@connection.stubs(:Open).with('Provider=SQLOLEDB.1;User ID=sa;Password=Pupp3t1@;Initial Catalog=master;Application Name=Puppet;Data Source=localhost')
5252
subject.open_and_run_command('query', {'admin' => 'sa', 'pass' => 'Pupp3t1@', 'instance' => 'MSSQLSERVER'})
5353
end
5454
it 'should add a non default instance to connection string' do
55-
@connection.stubs(:Open).with('Provider=SQLOLEDB.1;Persist Security Info=False;User ID=superuser;password=puppetTested;Initial Catalog=master;Application Name=Puppet;Data Source=localhost\LOGGING;')
55+
@connection.stubs(:Open).with('Provider=SQLOLEDB.1;User ID=superuser;Password=puppetTested;Initial Catalog=master;Application Name=Puppet;Data Source=localhost\LOGGING')
5656
subject.open_and_run_command('query', {'admin' => 'superuser', 'pass' => 'puppetTested', 'instance' => 'LOGGING'})
5757
end
5858
end

0 commit comments

Comments
 (0)