Methods
S
T
Instance Public methods
setup()
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 112
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 123
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_only_development_database_when_rails_env_is_development()
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 144
def test_creates_only_development_database_when_rails_env_is_development
  ActiveRecord::Tasks::DatabaseTasks.expects(:create).
    with('database' => 'dev-db')
  ENV.expects(:[]).with('RAILS_ENV').returns('development')

  ActiveRecord::Tasks::DatabaseTasks.create_current(
    ActiveSupport::StringInquirer.new('development')
  )
end
test_creates_test_and_development_databases_when_env_was_not_specified()
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 132
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')
  ENV.expects(:[]).with('RAILS_ENV').returns(nil)

  ActiveRecord::Tasks::DatabaseTasks.create_current(
    ActiveSupport::StringInquirer.new('development')
  )
end
test_establishes_connection_for_the_given_environment()
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 154
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