class ActiveRecord::MySQLStructureLoadTest
Public Instance Methods
setup()
click to toggle source
# File activerecord/test/cases/tasks/mysql_rake_test.rb, line 360 def setup @configuration = { "adapter" => "mysql2", "database" => "test-db" } end
test_structure_load()
click to toggle source
# File activerecord/test/cases/tasks/mysql_rake_test.rb, line 367 def test_structure_load filename = "awesome-file.sql" expected_command = ["mysql", "--noop", "--execute", %{SET FOREIGN_KEY_CHECKS = 0; SOURCE #{filename}; SET FOREIGN_KEY_CHECKS = 1}, "--database", "test-db"] assert_called_with(Kernel, :system, expected_command, returns: true) do with_structure_load_flags(["--noop"]) do ActiveRecord::Tasks::DatabaseTasks.structure_load(@configuration, filename) end end end
Private Instance Methods
with_structure_load_flags(flags) { || ... }
click to toggle source
# File activerecord/test/cases/tasks/mysql_rake_test.rb, line 379 def with_structure_load_flags(flags) old = ActiveRecord::Tasks::DatabaseTasks.structure_load_flags ActiveRecord::Tasks::DatabaseTasks.structure_load_flags = flags yield ensure ActiveRecord::Tasks::DatabaseTasks.structure_load_flags = old end