Skip to content

Business intelligence made simple

Removed unneeded code [skip ci]

Andrew Kanee9d3079344c4
diff --git a/test/adapters/postgresql_test.rb b/test/adapters/postgresql_test.rb
index 62e68562..6828ce58 100644
--- a/test/adapters/postgresql_test.rb
+++ b/test/adapters/postgresql_test.rb
@@ -12,11 +12,7 @@ class PostgresqlTest < ActionDispatch::IntegrationTest
end
def test_audit
- if no_binds?
- assert_audit "SELECT 'world' AS hello", "SELECT {var} AS hello", var: "world"
- else
- assert_audit "SELECT $1 AS hello\n\n[\"world\"]", "SELECT {var} AS hello", var: "world"
- end
+ assert_audit "SELECT $1 AS hello\n\n[\"world\"]", "SELECT {var} AS hello", var: "world"
end
def test_string
@@ -56,43 +52,19 @@ class PostgresqlTest < ActionDispatch::IntegrationTest
end
def test_bad_position
- if no_binds?
- assert_error "syntax error at or near \"'hello'\"\nLINE 1: SELECT 'world' AS 'hello'", "SELECT 'world' AS {var}", var: "hello"
- else
- assert_bad_position "SELECT 'world' AS {var}", var: "hello"
- end
+ assert_bad_position "SELECT 'world' AS {var}", var: "hello"
end
def test_bad_position_before
- if no_binds?
- assert_result [{"?column?" => "world"}], "SELECT{var}", var: "world"
- else
- assert_error "syntax error at or near \"SELECT$1\"", "SELECT{var}", var: "world"
- end
+ assert_error "syntax error at or near \"SELECT$1\"", "SELECT{var}", var: "world"
end
def test_bad_position_after
- if no_binds?
- assert_error "syntax error at or near \"456\"\nLINE 1: SELECT 'world'456", "SELECT {var}456", var: "world"
- assert_equal "SELECT 'world'456", Blazer::Audit.last.statement
- else
- assert_error "syntax error at or near \"456\"\nLINE 1: SELECT $1 456", "SELECT {var}456", var: "world"
- assert_equal "SELECT $1 456\n\n[\"world\"]", Blazer::Audit.last.statement
- end
+ assert_error "syntax error at or near \"456\"\nLINE 1: SELECT $1 456", "SELECT {var}456", var: "world"
+ assert_equal "SELECT $1 456\n\n[\"world\"]", Blazer::Audit.last.statement
end
def test_quoted
- if no_binds?
- assert_error "syntax error at or near \"''\"\nLINE 1: SELECT ''world'' AS hello", "SELECT '{var}' AS hello", var: "world"
- else
- assert_error "could not determine data type of parameter $1", "SELECT '{var}' AS hello", var: "world"
- end
- end
-
- private
-
- def no_binds?
- ActiveRecord::VERSION::STRING.to_f < 6.1 &&
- Blazer.data_sources[data_source].settings["url"].include?("prepared_statements=false")
+ assert_error "could not determine data type of parameter $1", "SELECT '{var}' AS hello", var: "world"
end
end