diff options
Diffstat (limited to 'activerecord/test/cases/tasks/postgresql_rake_test.rb')
-rw-r--r-- | activerecord/test/cases/tasks/postgresql_rake_test.rb | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/activerecord/test/cases/tasks/postgresql_rake_test.rb b/activerecord/test/cases/tasks/postgresql_rake_test.rb index 00005e7a0d..0cb90781f1 100644 --- a/activerecord/test/cases/tasks/postgresql_rake_test.rb +++ b/activerecord/test/cases/tasks/postgresql_rake_test.rb @@ -112,7 +112,7 @@ if current_adapter?(:PostgreSQLAdapter) ActiveRecord::Base.stub(:connection, @connection) do ActiveRecord::Base.stub(:establish_connection, -> * { raise Exception }) do assert_raises(Exception) { ActiveRecord::Tasks::DatabaseTasks.create @configuration } - assert_match "Couldn't create database for #{@configuration.inspect}", $stderr.string + assert_match "Couldn't create '#{@configuration['database']}' database. Please check your configuration.", $stderr.string end end end @@ -166,12 +166,17 @@ if current_adapter?(:PostgreSQLAdapter) def test_establishes_connection_to_postgresql_database ActiveRecord::Base.stub(:connection, @connection) do - ActiveRecord::Base.expects(:establish_connection).with( - "adapter" => "postgresql", - "database" => "postgres", - "schema_search_path" => "public" - ) - ActiveRecord::Tasks::DatabaseTasks.drop @configuration + assert_called_with( + ActiveRecord::Base, + :establish_connection, + [ + "adapter" => "postgresql", + "database" => "postgres", + "schema_search_path" => "public" + ] + ) do + ActiveRecord::Tasks::DatabaseTasks.drop @configuration + end end end @@ -361,7 +366,7 @@ if current_adapter?(:PostgreSQLAdapter) assert_called_with( Kernel, :system, - ["pg_dump", "-s", "-x", "-O", "-f", @filename, "my-app-db"], + ["pg_dump", "-s", "-X", "-x", "-O", "-f", @filename, "my-app-db"], returns: true ) do ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename) @@ -378,7 +383,7 @@ if current_adapter?(:PostgreSQLAdapter) end def test_structure_dump_with_extra_flags - expected_command = ["pg_dump", "-s", "-x", "-O", "-f", @filename, "--noop", "my-app-db"] + expected_command = ["pg_dump", "-s", "-X", "-x", "-O", "-f", @filename, "--noop", "my-app-db"] assert_called_with(Kernel, :system, expected_command, returns: true) do with_structure_dump_flags(["--noop"]) do @@ -396,7 +401,7 @@ if current_adapter?(:PostgreSQLAdapter) assert_called_with( Kernel, :system, - ["pg_dump", "-s", "-x", "-O", "-f", @filename, "-T", "foo", "-T", "bar", "my-app-db"], + ["pg_dump", "-s", "-X", "-x", "-O", "-f", @filename, "-T", "foo", "-T", "bar", "my-app-db"], returns: true ) do ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename) @@ -410,7 +415,7 @@ if current_adapter?(:PostgreSQLAdapter) assert_called_with( Kernel, :system, - ["pg_dump", "-s", "-x", "-O", "-f", @filename, "--schema=foo", "--schema=bar", "my-app-db"], + ["pg_dump", "-s", "-X", "-x", "-O", "-f", @filename, "--schema=foo", "--schema=bar", "my-app-db"], returns: true ) do ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename) @@ -423,7 +428,7 @@ if current_adapter?(:PostgreSQLAdapter) assert_called_with( Kernel, :system, - ["pg_dump", "-s", "-x", "-O", "-f", @filename, "my-app-db"], + ["pg_dump", "-s", "-X", "-x", "-O", "-f", @filename, "my-app-db"], returns: true ) do with_dump_schemas(:all) do @@ -436,7 +441,7 @@ if current_adapter?(:PostgreSQLAdapter) assert_called_with( Kernel, :system, - ["pg_dump", "-s", "-x", "-O", "-f", @filename, "--schema=foo", "--schema=bar", "my-app-db"], + ["pg_dump", "-s", "-X", "-x", "-O", "-f", @filename, "--schema=foo", "--schema=bar", "my-app-db"], returns: true ) do with_dump_schemas("foo,bar") do @@ -450,7 +455,7 @@ if current_adapter?(:PostgreSQLAdapter) assert_called_with( Kernel, :system, - ["pg_dump", "-s", "-x", "-O", "-f", filename, "my-app-db"], + ["pg_dump", "-s", "-X", "-x", "-O", "-f", filename, "my-app-db"], returns: nil ) do e = assert_raise(RuntimeError) do |