class ActiveRecord::MySQLPurgeTest

Public Instance Methods

setup() click to toggle source
# File activerecord/test/cases/tasks/mysql_rake_test.rb, line 215
def setup
  @connection    = stub(recreate_database: true)
  @configuration = {
    "adapter"  => "mysql2",
    "database" => "test-db"
  }

  ActiveRecord::Base.stubs(:connection).returns(@connection)
  ActiveRecord::Base.stubs(:establish_connection).returns(true)
end
test_establishes_connection_to_the_appropriate_database() click to toggle source
# File activerecord/test/cases/tasks/mysql_rake_test.rb, line 226
def test_establishes_connection_to_the_appropriate_database
  ActiveRecord::Base.expects(:establish_connection).with(@configuration)

  ActiveRecord::Tasks::DatabaseTasks.purge @configuration
end
test_recreates_database_with_no_default_options() click to toggle source
# File activerecord/test/cases/tasks/mysql_rake_test.rb, line 232
def test_recreates_database_with_no_default_options
  @connection.expects(:recreate_database).
    with("test-db", {})

  ActiveRecord::Tasks::DatabaseTasks.purge @configuration
end
test_recreates_database_with_the_given_options() click to toggle source
# File activerecord/test/cases/tasks/mysql_rake_test.rb, line 239
def test_recreates_database_with_the_given_options
  @connection.expects(:recreate_database).
    with("test-db", charset: "latin", collation: "latin1_swedish_ci")

  ActiveRecord::Tasks::DatabaseTasks.purge @configuration.merge(
    "encoding" => "latin", "collation" => "latin1_swedish_ci")
end