diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-09-22 10:49:49 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-09-22 11:10:58 +0200 |
commit | 3931cec9cd3091ef4b8ee40066b896385d2085ea (patch) | |
tree | b0b5f3a5992201577465d350e1cd4507ede41339 /activerecord/test/cases | |
parent | 8842ce239562d3fbc82198ac3c4618935134ff39 (diff) | |
parent | 40664444eef2432fc564d8eecb647854bd06e5c3 (diff) | |
download | rails-3931cec9cd3091ef4b8ee40066b896385d2085ea.tar.gz rails-3931cec9cd3091ef4b8ee40066b896385d2085ea.tar.bz2 rails-3931cec9cd3091ef4b8ee40066b896385d2085ea.zip |
Merge pull request #20569 from theSteveMitchell/master
Check mysql structure_load for errors
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/tasks/mysql_rake_test.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/activerecord/test/cases/tasks/mysql_rake_test.rb b/activerecord/test/cases/tasks/mysql_rake_test.rb index d0deb4c273..a93fa57257 100644 --- a/activerecord/test/cases/tasks/mysql_rake_test.rb +++ b/activerecord/test/cases/tasks/mysql_rake_test.rb @@ -270,15 +270,16 @@ module ActiveRecord ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, filename) end - def test_warn_when_external_structure_dump_fails + def test_warn_when_external_structure_dump_command_execution_fails filename = "awesome-file.sql" - Kernel.expects(:system).with("mysqldump", "--result-file", filename, "--no-data", "--routines", "test-db").returns(false) + Kernel.expects(:system) + .with("mysqldump", "--result-file", filename, "--no-data", "--routines", "test-db") + .returns(false) - warnings = capture(:stderr) do + e = assert_raise(RuntimeError) { ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, filename) - end - - assert_match(/Could not dump the database structure/, warnings) + } + assert_match(/^failed to execute: `mysqldump`$/, e.message) end def test_structure_dump_with_port_number @@ -311,6 +312,7 @@ module ActiveRecord def test_structure_load filename = "awesome-file.sql" Kernel.expects(:system).with('mysql', '--execute', %{SET FOREIGN_KEY_CHECKS = 0; SOURCE #{filename}; SET FOREIGN_KEY_CHECKS = 1}, "--database", "test-db") + .returns(true) ActiveRecord::Tasks::DatabaseTasks.structure_load(@configuration, filename) end |