aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/support
diff options
context:
space:
mode:
authorGuo Xiang Tan <tgx_world@hotmail.com>2014-03-18 19:06:44 -0700
committerGuo Xiang Tan <tgx_world@hotmail.com>2014-03-20 11:48:17 -0700
commit79405a07a45dfaeb6c39d794b42b72ee73e420e9 (patch)
tree22b64cb731b66efbba6565ea95c25c72fb040b06 /activerecord/test/support
parentf522aebb6a844a278f1230e8e1f201e96f95203b (diff)
downloadrails-79405a07a45dfaeb6c39d794b42b72ee73e420e9.tar.gz
rails-79405a07a45dfaeb6c39d794b42b72ee73e420e9.tar.bz2
rails-79405a07a45dfaeb6c39d794b42b72ee73e420e9.zip
Extract with_example_table into helper method.
This setups the helper method which other tests can benefit from.
Diffstat (limited to 'activerecord/test/support')
-rw-r--r--activerecord/test/support/ddl_helper.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/support/ddl_helper.rb b/activerecord/test/support/ddl_helper.rb
new file mode 100644
index 0000000000..0107babaaf
--- /dev/null
+++ b/activerecord/test/support/ddl_helper.rb
@@ -0,0 +1,8 @@
+module DdlHelper
+ def with_example_table(connection, table_name, definition = nil)
+ connection.exec_query("CREATE TABLE #{table_name}(#{definition})")
+ yield
+ ensure
+ connection.exec_query("DROP TABLE #{table_name}")
+ end
+end