Methods
S
T
Instance Public methods
setup()
# File activerecord/test/cases/tasks/postgresql_rake_test.rb, line 92
def setup
  @connection    = stub(:drop_database => true)
  @configuration = {
    'adapter'  => 'postgresql',
    'database' => 'my-app-db'
  }

  ActiveRecord::Base.stubs(:connection).returns(@connection)
  ActiveRecord::Base.stubs(:establish_connection).returns(true)

  $stdout, @original_stdout = StringIO.new, $stdout
  $stderr, @original_stderr = StringIO.new, $stderr
end
teardown()
# File activerecord/test/cases/tasks/postgresql_rake_test.rb, line 106
def teardown
  $stdout, $stderr = @original_stdout, @original_stderr
end
test_drops_database()
# File activerecord/test/cases/tasks/postgresql_rake_test.rb, line 120
def test_drops_database
  @connection.expects(:drop_database).with('my-app-db')

  ActiveRecord::Tasks::DatabaseTasks.drop @configuration
end
test_establishes_connection_to_postgresql_database()
# File activerecord/test/cases/tasks/postgresql_rake_test.rb, line 110
def test_establishes_connection_to_postgresql_database
  ActiveRecord::Base.expects(:establish_connection).with(
    'adapter'            => 'postgresql',
    'database'           => 'postgres',
    'schema_search_path' => 'public'
  )

  ActiveRecord::Tasks::DatabaseTasks.drop @configuration
end
test_when_database_dropped_successfully_outputs_info_to_stdout()
# File activerecord/test/cases/tasks/postgresql_rake_test.rb, line 126
def test_when_database_dropped_successfully_outputs_info_to_stdout
  ActiveRecord::Tasks::DatabaseTasks.drop @configuration

  assert_equal $stdout.string, "Dropped database 'my-app-db'\n"
end