Methods
S
T
Instance Public methods
setup()
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 146
def setup
  @configurations = {
    'development' => {'database' => 'dev-db'},
    'test'        => {'database' => 'test-db'},
    'production'  => {'database' => 'prod-db'}
  }

  ActiveRecord::Base.stubs(:configurations).returns(@configurations)
  ActiveRecord::Base.stubs(:establish_connection).returns(true)
end
test_creates_current_environment_database()
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 157
def test_creates_current_environment_database
  ActiveRecord::Tasks::DatabaseTasks.expects(:create).
    with('database' => 'prod-db')

  ActiveRecord::Tasks::DatabaseTasks.create_current(
    ActiveSupport::StringInquirer.new('production')
  )
end
test_creates_test_and_development_databases_when_env_was_not_specified()
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 166
def test_creates_test_and_development_databases_when_env_was_not_specified
  ActiveRecord::Tasks::DatabaseTasks.expects(:create).
    with('database' => 'dev-db')
  ActiveRecord::Tasks::DatabaseTasks.expects(:create).
    with('database' => 'test-db')

  ActiveRecord::Tasks::DatabaseTasks.create_current(
    ActiveSupport::StringInquirer.new('development')
  )
end
test_creates_test_and_development_databases_when_rails_env_is_development()
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 177
def test_creates_test_and_development_databases_when_rails_env_is_development
  old_env = ENV['RAILS_ENV']
  ENV['RAILS_ENV'] = 'development'
  ActiveRecord::Tasks::DatabaseTasks.expects(:create).
    with('database' => 'dev-db')
  ActiveRecord::Tasks::DatabaseTasks.expects(:create).
    with('database' => 'test-db')

  ActiveRecord::Tasks::DatabaseTasks.create_current(
    ActiveSupport::StringInquirer.new('development')
  )
ensure
  ENV['RAILS_ENV'] = old_env
end
test_establishes_connection_for_the_given_environment()
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 192
def test_establishes_connection_for_the_given_environment
  ActiveRecord::Tasks::DatabaseTasks.stubs(:create).returns true

  ActiveRecord::Base.expects(:establish_connection).with(:development)

  ActiveRecord::Tasks::DatabaseTasks.create_current(
    ActiveSupport::StringInquirer.new('development')
  )
end