|
13 | 13 | let(:attributes) do { :db => 'spec_db' } end |
14 | 14 |
|
15 | 15 | it "executes with the given psql_path on the given DB" do |
16 | | - expect(Puppet::Util::SUIDManager).to receive(:run_and_capture).with( |
17 | | - ['psql', '-d', attributes[:db], '-t', '-c', 'SELECT something'], |
18 | | - 'postgres', |
19 | | - 'postgres' |
20 | | - ) |
| 16 | + expect(provider).to receive(:run_command).with(['psql', '-d', |
| 17 | + attributes[:db], '-t', '-c', 'SELECT something'], 'postgres', |
| 18 | + 'postgres') |
| 19 | + |
21 | 20 | provider.run_sql_command("SELECT something") |
22 | 21 | end |
23 | 22 | end |
|
32 | 31 |
|
33 | 32 | it "executes with the given psql_path on the given DB" do |
34 | 33 | expect(Dir).to receive(:chdir).with(attributes[:cwd]).and_yield |
35 | | - expect(Puppet::Util::SUIDManager).to receive(:run_and_capture).with( |
36 | | - [attributes[:psql_path], '-d', attributes[:db], '-t', '-c', 'SELECT something'], |
37 | | - attributes[:psql_user], |
38 | | - attributes[:psql_group] |
39 | | - ) |
| 34 | + expect(provider).to receive(:run_command).with([attributes[:psql_path], |
| 35 | + '-d', attributes[:db], '-t', '-c', 'SELECT something'], |
| 36 | + attributes[:psql_user], attributes[:psql_group]) |
| 37 | + |
40 | 38 | provider.run_sql_command("SELECT something") |
41 | 39 | end |
42 | 40 | end |
|
46 | 44 | } end |
47 | 45 |
|
48 | 46 | it "executes with the given search_path" do |
49 | | - expect(Puppet::Util::SUIDManager).to receive(:run_and_capture).with( |
50 | | - ['psql', '-t', '-c', 'set search_path to schema1; SELECT something'], |
51 | | - 'postgres', |
52 | | - 'postgres' |
53 | | - ) |
| 47 | + expect(provider).to receive(:run_command).with(['psql', '-t', '-c', |
| 48 | + 'set search_path to schema1; SELECT something'], |
| 49 | + 'postgres', 'postgres') |
| 50 | + |
54 | 51 | provider.run_sql_command("SELECT something") |
55 | 52 | end |
56 | 53 | end |
|
60 | 57 | } end |
61 | 58 |
|
62 | 59 | it "executes with the given search_path" do |
63 | | - expect(Puppet::Util::SUIDManager).to receive(:run_and_capture).with( |
64 | | - ['psql', '-t', '-c', 'set search_path to schema1,schema2; SELECT something'], |
| 60 | + expect(provider).to receive(:run_command).with(['psql', '-t', '-c', |
| 61 | + 'set search_path to schema1,schema2; SELECT something'], |
65 | 62 | 'postgres', |
66 | 63 | 'postgres' |
67 | 64 | ) |
| 65 | + |
68 | 66 | provider.run_sql_command("SELECT something") |
69 | 67 | end |
70 | 68 | end |
|
0 commit comments