aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/tasks
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-06-16 19:28:38 +0200
committerYves Senn <yves.senn@gmail.com>2014-06-17 09:20:58 +0200
commite2f232aba15937a4b9d14bd91e0392c6d55be58d (patch)
treea9715a517d1fd59902b104845eddcad534c94be1 /activerecord/test/cases/tasks
parentb4b5af0342cdb5917d9342cd4da245f19c3b4025 (diff)
downloadrails-e2f232aba15937a4b9d14bd91e0392c6d55be58d.tar.gz
rails-e2f232aba15937a4b9d14bd91e0392c6d55be58d.tar.bz2
rails-e2f232aba15937a4b9d14bd91e0392c6d55be58d.zip
add `bin/rake db:purge` task to empty the current database.
Diffstat (limited to 'activerecord/test/cases/tasks')
-rw-r--r--activerecord/test/cases/tasks/database_tasks_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/activerecord/test/cases/tasks/database_tasks_test.rb b/activerecord/test/cases/tasks/database_tasks_test.rb
index c0ab821ab6..0f48c8d5fc 100644
--- a/activerecord/test/cases/tasks/database_tasks_test.rb
+++ b/activerecord/test/cases/tasks/database_tasks_test.rb
@@ -285,6 +285,34 @@ module ActiveRecord
end
end
+ class DatabaseTasksPurgeCurrentTest < ActiveRecord::TestCase
+ def test_purges_current_environment_database
+ configurations = {
+ 'development' => {'database' => 'dev-db'},
+ 'test' => {'database' => 'test-db'},
+ 'production' => {'database' => 'prod-db'}
+ }
+ ActiveRecord::Base.stubs(:configurations).returns(configurations)
+
+ ActiveRecord::Tasks::DatabaseTasks.expects(:purge).
+ with('database' => 'prod-db')
+
+ ActiveRecord::Tasks::DatabaseTasks.purge_current('production')
+ end
+ end
+
+ class DatabaseTasksPurgeAllTest < ActiveRecord::TestCase
+ def test_purge_all_local_configurations
+ configurations = {:development => {'database' => 'my-db'}}
+ ActiveRecord::Base.stubs(:configurations).returns(configurations)
+
+ ActiveRecord::Tasks::DatabaseTasks.expects(:purge).
+ with('database' => 'my-db')
+
+ ActiveRecord::Tasks::DatabaseTasks.purge_all
+ end
+ end
+
class DatabaseTasksCharsetTest < ActiveRecord::TestCase
include DatabaseTasksSetupper