diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-10 14:24:28 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-10 14:24:28 +0000 |
commit | 65786805ca89bbcaf7aa89e74f99964e0f5fd89e (patch) | |
tree | 98a49d4d0c88dac11b1f062af5c6ef306727d951 /activerecord/test | |
parent | 4f2f408ba1a7dd976a1ec5061d05ef0439e5f942 (diff) | |
download | rails-65786805ca89bbcaf7aa89e74f99964e0f5fd89e.tar.gz rails-65786805ca89bbcaf7aa89e74f99964e0f5fd89e.tar.bz2 rails-65786805ca89bbcaf7aa89e74f99964e0f5fd89e.zip |
More incremental work on active schema for MySQL
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@884 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/active_schema_mysql.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/activerecord/test/active_schema_mysql.rb b/activerecord/test/active_schema_mysql.rb new file mode 100644 index 0000000000..d3ee5bfb66 --- /dev/null +++ b/activerecord/test/active_schema_mysql.rb @@ -0,0 +1,31 @@ +require 'abstract_unit' + +class ActiveSchemaTest < Test::Unit::TestCase + def setup + ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do + alias_method :real_execute, :execute + def execute(sql, name = nil) return sql end + end + end + + def teardown + ActiveRecord::ConnectionAdapters::MysqlAdapter.send(:alias_method, :execute, :real_execute) + end + + def test_drop_table + assert_equal "DROP TABLE people", drop_table(:people) + end + + def test_add_column + assert_equal "ALTER TABLE people ADD last_name varchar(255)", add_column(:people, :last_name, :string) + end + + def test_add_column_with_limit + assert_equal "ALTER TABLE people ADD key varchar(32)", add_column(:people, :key, :string, :limit => 32) + end + + private + def method_missing(method_symbol, *arguments) + ActiveRecord::Base.connection.send(method_symbol, *arguments) + end +end
\ No newline at end of file |