aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-06-24 03:06:40 +0900
committerkennyj <kennyj@gmail.com>2012-06-24 22:18:43 +0900
commit188d671f148cc2056baede675bed9b61d476c9fe (patch)
tree0394aced4a075cc3c51e0df90f7e85f9d0fffb49 /activerecord/test/cases
parentebe8a45444fb42b42768fba826f56a498c8b389a (diff)
downloadrails-188d671f148cc2056baede675bed9b61d476c9fe.tar.gz
rails-188d671f148cc2056baede675bed9b61d476c9fe.tar.bz2
rails-188d671f148cc2056baede675bed9b61d476c9fe.zip
Added a feature to add a database task. e.g. OracleDatabaseTasks
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/tasks/database_tasks_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/tasks/database_tasks_test.rb b/activerecord/test/cases/tasks/database_tasks_test.rb
index 5f36b2c841..f5c6b58b2f 100644
--- a/activerecord/test/cases/tasks/database_tasks_test.rb
+++ b/activerecord/test/cases/tasks/database_tasks_test.rb
@@ -16,6 +16,22 @@ module ActiveRecord
:postgresql => :postgresql_tasks,
:sqlite3 => :sqlite_tasks
}
+
+ class DatabaseTasksRegisterTask < ActiveRecord::TestCase
+ def test_register_task
+ klazz = Class.new do
+ def initialize(*arguments); end
+ def structure_dump(filename); end
+ end
+ instance = klazz.new
+
+ klazz.stubs(:new).returns instance
+ instance.expects(:structure_dump).with("awesome-file.sql")
+
+ ActiveRecord::Tasks::DatabaseTasks.register_task(/foo/, klazz)
+ ActiveRecord::Tasks::DatabaseTasks.structure_dump({'adapter' => :foo}, "awesome-file.sql")
+ end
+ end
class DatabaseTasksCreateTest < ActiveRecord::TestCase
include DatabaseTasksSetupper