aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migration_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/migration_test.rb')
-rw-r--r--activerecord/test/cases/migration_test.rb23
1 files changed, 16 insertions, 7 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index 2343e5610b..426eaebc8a 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -91,16 +91,25 @@ class MigrationTest < ActiveRecord::TestCase
Person.connection.drop_table :testings2 rescue nil
end
- def test_add_table
- assert !Reminder.table_exists?
+ def connection
+ ActiveRecord::Base.connection
+ end
- WeNeedReminders.up
+ def test_migration_instance_has_connection
+ migration = Class.new(ActiveRecord::Migration).new
+ assert_equal connection, migration.connection
+ end
- assert Reminder.create("content" => "hello world", "remind_at" => Time.now)
- assert_equal "hello world", Reminder.find(:first).content
+ def test_method_missing_delegates_to_connection
+ migration = Class.new(ActiveRecord::Migration) {
+ def connection
+ Class.new {
+ def create_table; "hi mom!"; end
+ }.new
+ end
+ }.new
- WeNeedReminders.down
- assert_raise(ActiveRecord::StatementInvalid) { Reminder.find(:first) }
+ assert_equal "hi mom!", migration.method_missing(:create_table)
end
def test_add_table_with_decimals