aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migration/helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/migration/helper.rb')
-rw-r--r--activerecord/test/cases/migration/helper.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/helper.rb b/activerecord/test/cases/migration/helper.rb
new file mode 100644
index 0000000000..cb8ead0835
--- /dev/null
+++ b/activerecord/test/cases/migration/helper.rb
@@ -0,0 +1,41 @@
+require "cases/helper"
+
+module ActiveRecord
+ class Migration
+ module TestHelper
+ attr_reader :connection, :table_name
+
+ class TestModel < ActiveRecord::Base
+ self.table_name = 'test_models'
+ end
+
+ def setup
+ super
+ @connection = ActiveRecord::Base.connection
+ connection.create_table :test_models do |t|
+ t.timestamps
+ end
+
+ TestModel.reset_column_information
+ end
+
+ def teardown
+ super
+ connection.drop_table :test_models rescue nil
+ end
+
+ private
+ def add_column(*args)
+ connection.add_column(*args)
+ end
+
+ def remove_column(*args)
+ connection.remove_column(*args)
+ end
+
+ def rename_column(*args)
+ connection.rename_column(*args)
+ end
+ end
+ end
+end