|
14 | 14 |
|
15 | 15 | it "executes with the given psql_path on the given DB" do |
16 | 16 | expect(provider).to receive(:run_command).with(['psql', '-d', |
17 | | - attributes[:db], '-t', '-c', 'SELECT something'], 'postgres', |
| 17 | + attributes[:db], '-t', '-c', '"SELECT \'something\' as \"Custom column\""'], 'postgres', |
18 | 18 | 'postgres') |
19 | 19 |
|
20 | | - provider.run_sql_command("SELECT something") |
| 20 | + provider.run_sql_command('SELECT \'something\' as "Custom column"') |
21 | 21 | end |
22 | 22 | end |
23 | 23 | describe "with psql_path and db" do |
|
32 | 32 | it "executes with the given psql_path on the given DB" do |
33 | 33 | expect(Dir).to receive(:chdir).with(attributes[:cwd]).and_yield |
34 | 34 | expect(provider).to receive(:run_command).with([attributes[:psql_path], |
35 | | - '-d', attributes[:db], '-t', '-c', 'SELECT something'], |
| 35 | + '-d', attributes[:db], '-t', '-c', '"SELECT \'something\' as \"Custom column\""'], |
36 | 36 | attributes[:psql_user], attributes[:psql_group]) |
37 | 37 |
|
38 | | - provider.run_sql_command("SELECT something") |
| 38 | + provider.run_sql_command('SELECT \'something\' as "Custom column"') |
39 | 39 | end |
40 | 40 | end |
41 | 41 | describe "with search_path string" do |
|
45 | 45 |
|
46 | 46 | it "executes with the given search_path" do |
47 | 47 | expect(provider).to receive(:run_command).with(['psql', '-t', '-c', |
48 | | - 'set search_path to schema1; SELECT something'], |
| 48 | + '"set search_path to schema1; SELECT \'something\' as \"Custom column\""'], |
49 | 49 | 'postgres', 'postgres') |
50 | 50 |
|
51 | | - provider.run_sql_command("SELECT something") |
| 51 | + provider.run_sql_command('SELECT \'something\' as "Custom column"') |
52 | 52 | end |
53 | 53 | end |
54 | 54 | describe "with search_path array" do |
|
58 | 58 |
|
59 | 59 | it "executes with the given search_path" do |
60 | 60 | expect(provider).to receive(:run_command).with(['psql', '-t', '-c', |
61 | | - 'set search_path to schema1,schema2; SELECT something'], |
| 61 | + '"set search_path to schema1,schema2; SELECT \'something\' as \"Custom column\""'], |
62 | 62 | 'postgres', |
63 | 63 | 'postgres' |
64 | 64 | ) |
65 | 65 |
|
66 | | - provider.run_sql_command("SELECT something") |
| 66 | + provider.run_sql_command('SELECT \'something\' as "Custom column"') |
67 | 67 | end |
68 | 68 | end |
69 | 69 | end |
|
0 commit comments