@@ -29,11 +29,14 @@ defmodule Ecto.Integration.StorageTest do
2929
3030 def create_database ( owner \\ nil ) do
3131 query = "CREATE DATABASE #{ params ( ) [ :database ] } "
32- query = if owner do
33- query <> " OWNER #{ owner } ;"
34- else
35- query <> ";"
36- end
32+
33+ query =
34+ if owner do
35+ query <> " OWNER #{ owner } ;"
36+ else
37+ query <> ";"
38+ end
39+
3740 run_psql ( query )
3841 end
3942
@@ -86,8 +89,8 @@ defmodule Ecto.Integration.StorageTest do
8689 drop_database ( )
8790 end
8891
89- test "storage up with custom timestamp timezone" do
90- assert Postgres . storage_up ( [ timestamp : "America/New_York" ] ++ params ( ) ) == :ok
92+ test "storage up with custom timezone" do
93+ assert Postgres . storage_up ( [ timezone : "America/New_York" ] ++ params ( ) ) == :ok
9194 { output , _ } = run_psql ( "SHOW timezone;" , [ params ( ) [ :database ] ] )
9295 assert output =~ "America/New_York"
9396 after
@@ -109,10 +112,12 @@ defmodule Ecto.Integration.StorageTest do
109112 end
110113
111114 test "storage up with unprivileged user with access to the database" do
112- unprivileged_params = Keyword . merge ( params ( ) ,
113- username: "unprivileged" ,
114- password: "pass"
115- )
115+ unprivileged_params =
116+ Keyword . merge ( params ( ) ,
117+ username: "unprivileged" ,
118+ password: "pass"
119+ )
120+
116121 run_psql ( "CREATE USER unprivileged WITH NOCREATEDB PASSWORD 'pass'" )
117122 refute Postgres . storage_up ( unprivileged_params ) == :ok
118123 create_database ( "unprivileged" )
@@ -190,7 +195,9 @@ defmodule Ecto.Integration.StorageTest do
190195 assert contents =~ "CREATE TABLE public.schema_migrations"
191196 assert contents =~ ~s[ INSERT INTO public."schema_migrations" (version) VALUES (#{ version } )]
192197 assert contents =~ "CREATE TABLE test_schema.schema_migrations"
193- refute contents =~ ~s[ INSERT INTO test_schema."schema_migrations" (version) VALUES (#{ version } )]
198+
199+ refute contents =~
200+ ~s[ INSERT INTO test_schema."schema_migrations" (version) VALUES (#{ version } )]
194201 after
195202 drop_schema_migrations_table ( PoolRepo . config ( ) [ :database ] , "test_schema" )
196203 drop_schema ( PoolRepo . config ( ) [ :database ] , "test_schema" )
@@ -212,7 +219,9 @@ defmodule Ecto.Integration.StorageTest do
212219 assert contents =~ "CREATE TABLE public.schema_migrations"
213220 assert contents =~ ~s[ INSERT INTO public."schema_migrations" (version) VALUES (#{ version } )]
214221 assert contents =~ "CREATE TABLE test_schema.schema_migrations"
215- assert contents =~ ~s[ INSERT INTO test_schema."schema_migrations" (version) VALUES (#{ version } )]
222+
223+ assert contents =~
224+ ~s[ INSERT INTO test_schema."schema_migrations" (version) VALUES (#{ version } )]
216225 after
217226 drop_schema_migrations_table ( PoolRepo . config ( ) [ :database ] , "test_schema" )
218227 drop_schema ( PoolRepo . config ( ) [ :database ] , "test_schema" )
@@ -234,13 +243,14 @@ defmodule Ecto.Integration.StorageTest do
234243 refute contents =~ "CREATE TABLE public.schema_migrations"
235244 refute contents =~ ~s[ INSERT INTO public."schema_migrations" (version) VALUES (#{ version } )]
236245 assert contents =~ "CREATE TABLE test_schema.schema_migrations"
237- assert contents =~ ~s[ INSERT INTO test_schema."schema_migrations" (version) VALUES (#{ version } )]
246+
247+ assert contents =~
248+ ~s[ INSERT INTO test_schema."schema_migrations" (version) VALUES (#{ version } )]
238249 after
239250 drop_schema_migrations_table ( PoolRepo . config ( ) [ :database ] , "test_schema" )
240251 drop_schema ( PoolRepo . config ( ) [ :database ] , "test_schema" )
241252 end
242253
243-
244254 test "storage status is up when database is created" do
245255 create_database ( )
246256 assert :up == Postgres . storage_status ( params ( ) )
0 commit comments