class ActiveRecord::DatabaseTasksDropAllTest

Public Instance Methods

setup() click to toggle source
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 229
def setup
  @configurations = { development: { "database" => "my-db" } }

  ActiveRecord::Base.stubs(:configurations).returns(@configurations)
end
test_drops_configurations_with_blank_hosts() click to toggle source
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 276
def test_drops_configurations_with_blank_hosts
  @configurations[:development].merge!("host" => nil)

  ActiveRecord::Tasks::DatabaseTasks.expects(:drop)

  ActiveRecord::Tasks::DatabaseTasks.drop_all
end
test_drops_configurations_with_local_host() click to toggle source
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 268
def test_drops_configurations_with_local_host
  @configurations[:development].merge!("host" => "localhost")

  ActiveRecord::Tasks::DatabaseTasks.expects(:drop)

  ActiveRecord::Tasks::DatabaseTasks.drop_all
end
test_drops_configurations_with_local_ip() click to toggle source
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 260
def test_drops_configurations_with_local_ip
  @configurations[:development].merge!("host" => "127.0.0.1")

  ActiveRecord::Tasks::DatabaseTasks.expects(:drop)

  ActiveRecord::Tasks::DatabaseTasks.drop_all
end
test_ignores_configurations_without_databases() click to toggle source
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 235
def test_ignores_configurations_without_databases
  @configurations[:development].merge!("database" => nil)

  ActiveRecord::Tasks::DatabaseTasks.expects(:drop).never

  ActiveRecord::Tasks::DatabaseTasks.drop_all
end
test_ignores_remote_databases() click to toggle source
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 243
def test_ignores_remote_databases
  @configurations[:development].merge!("host" => "my.server.tld")
  $stderr.stubs(:puts).returns(nil)

  ActiveRecord::Tasks::DatabaseTasks.expects(:drop).never

  ActiveRecord::Tasks::DatabaseTasks.drop_all
end
test_warning_for_remote_databases() click to toggle source
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 252
def test_warning_for_remote_databases
  @configurations[:development].merge!("host" => "my.server.tld")

  $stderr.expects(:puts).with("This task only modifies local databases. my-db is on a remote host.")

  ActiveRecord::Tasks::DatabaseTasks.drop_all
end