aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/defaults_test.rb4
-rw-r--r--activerecord/test/cases/schema_authorization_test_postgresql.rb4
-rw-r--r--activerecord/test/schema/postgresql.sql4
3 files changed, 8 insertions, 4 deletions
diff --git a/activerecord/test/cases/defaults_test.rb b/activerecord/test/cases/defaults_test.rb
index ac133da47a..bd19ffcc29 100644
--- a/activerecord/test/cases/defaults_test.rb
+++ b/activerecord/test/cases/defaults_test.rb
@@ -61,7 +61,9 @@ class DefaultTest < ActiveRecord::TestCase
if current_adapter?(:PostgreSQLAdapter)
def test_multiline_default_text
- assert_equal "--- []\n\n", Default.columns_hash['multiline_default'].default
+ # older postgres versions represent the default with escapes ("\\012" for a newline)
+ assert ( "--- []\n\n" == Default.columns_hash['multiline_default'].default ||
+ "--- []\\012\\012" == Default.columns_hash['multiline_default'].default)
end
end
end
diff --git a/activerecord/test/cases/schema_authorization_test_postgresql.rb b/activerecord/test/cases/schema_authorization_test_postgresql.rb
index 61838d4bf7..7a0796ef53 100644
--- a/activerecord/test/cases/schema_authorization_test_postgresql.rb
+++ b/activerecord/test/cases/schema_authorization_test_postgresql.rb
@@ -18,7 +18,7 @@ class SchemaAuthorizationTest < ActiveRecord::TestCase
@connection.execute "SET search_path TO '$user',public"
set_session_auth
USERS.each do |u|
- @connection.execute "CREATE ROLE #{u}"
+ @connection.execute "CREATE USER #{u}"
@connection.execute "CREATE SCHEMA AUTHORIZATION #{u}"
set_session_auth u
@connection.execute "CREATE TABLE #{TABLE_NAME} (#{COLUMNS.join(',')})"
@@ -32,7 +32,7 @@ class SchemaAuthorizationTest < ActiveRecord::TestCase
@connection.execute "RESET search_path"
USERS.each do |u|
@connection.execute "DROP SCHEMA #{u} CASCADE"
- @connection.execute "DROP ROLE #{u}"
+ @connection.execute "DROP USER #{u}"
end
end
diff --git a/activerecord/test/schema/postgresql.sql b/activerecord/test/schema/postgresql.sql
index f2198f24e9..885dab7a79 100644
--- a/activerecord/test/schema/postgresql.sql
+++ b/activerecord/test/schema/postgresql.sql
@@ -110,7 +110,9 @@ CREATE TABLE defaults (
positive_integer integer default 1,
negative_integer integer default -1,
decimal_number decimal(3,2) default 2.78,
- multiline_default text DEFAULT E'--- []\n\n'::text
+ multiline_default text DEFAULT '--- []
+
+'::text
);
CREATE TABLE auto_id_tests (