Methods
- S
- T
-
- teardown,
- test_create_when_database_exists_outputs_info_to_stderr,
- test_creates_database_with_given_collation,
- test_creates_database_with_given_encoding,
- test_creates_database_with_no_default_options,
- test_establishes_connection_to_database,
- test_establishes_connection_without_database,
- test_when_database_created_successfully_outputs_info_to_stdout
Instance Public methods
setup()
Link
# File activerecord/test/cases/tasks/mysql_rake_test.rb, line 7 def setup @connection = stub(:create_database => true) @configuration = { 'adapter' => 'mysql2', '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()
Link
test_create_when_database_exists_outputs_info_to_stderr()
Link
# File activerecord/test/cases/tasks/mysql_rake_test.rb, line 65 def test_create_when_database_exists_outputs_info_to_stderr ActiveRecord::Base.connection.stubs(:create_database).raises( ActiveRecord::Tasks::DatabaseAlreadyExists ) ActiveRecord::Tasks::DatabaseTasks.create @configuration assert_equal $stderr.string, "Database 'my-app-db' already exists\n" end
test_creates_database_with_given_collation()
Link
# File activerecord/test/cases/tasks/mysql_rake_test.rb, line 46 def test_creates_database_with_given_collation @connection.expects(:create_database). with('my-app-db', collation: 'latin1_swedish_ci') ActiveRecord::Tasks::DatabaseTasks.create @configuration.merge('collation' => 'latin1_swedish_ci') end
test_creates_database_with_given_encoding()
Link
# File activerecord/test/cases/tasks/mysql_rake_test.rb, line 39 def test_creates_database_with_given_encoding @connection.expects(:create_database). with('my-app-db', charset: 'latin1') ActiveRecord::Tasks::DatabaseTasks.create @configuration.merge('encoding' => 'latin1') end
test_creates_database_with_no_default_options()
Link
test_establishes_connection_to_database()
Link
test_establishes_connection_without_database()
Link
test_when_database_created_successfully_outputs_info_to_stdout()
Link