aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migration_test.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2015-12-06 06:44:22 +1030
committerMatthew Draper <matthew@trebex.net>2015-12-15 17:18:09 +1030
commita6d4e5e5320d90dac9e9e7dbfbea6bdc093af10e (patch)
tree8bc391ef4d3751e459b859bed969a6eec690e64c /activerecord/test/cases/migration_test.rb
parentdc8d40af5856e40bac7ed9d21198395e6a3fb93c (diff)
downloadrails-a6d4e5e5320d90dac9e9e7dbfbea6bdc093af10e.tar.gz
rails-a6d4e5e5320d90dac9e9e7dbfbea6bdc093af10e.tar.bz2
rails-a6d4e5e5320d90dac9e9e7dbfbea6bdc093af10e.zip
Internal test migrations use the private 'Current' version
Apart from specific versioning support, our tests should focus on the behaviour of whatever version they're accompanying, regardless of when they were written. Application code should *not* do this.
Diffstat (limited to 'activerecord/test/cases/migration_test.rb')
-rw-r--r--activerecord/test/cases/migration_test.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index c3c204cf9f..19be357b6e 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -132,12 +132,12 @@ class MigrationTest < ActiveRecord::TestCase
end
def test_migration_instance_has_connection
- migration = Class.new(ActiveRecord::Migration).new
+ migration = Class.new(ActiveRecord::Migration::Current).new
assert_equal ActiveRecord::Base.connection, migration.connection
end
def test_method_missing_delegates_to_connection
- migration = Class.new(ActiveRecord::Migration) {
+ migration = Class.new(ActiveRecord::Migration::Current) {
def connection
Class.new {
def create_table; "hi mom!"; end
@@ -226,7 +226,7 @@ class MigrationTest < ActiveRecord::TestCase
assert_raise(ActiveRecord::StatementInvalid) { Reminder.first }
end
- class MockMigration < ActiveRecord::Migration
+ class MockMigration < ActiveRecord::Migration::Current
attr_reader :went_up, :went_down
def initialize
@went_up = false
@@ -268,7 +268,7 @@ class MigrationTest < ActiveRecord::TestCase
def test_migrator_one_up_with_exception_and_rollback
assert_no_column Person, :last_name
- migration = Class.new(ActiveRecord::Migration) {
+ migration = Class.new(ActiveRecord::Migration::Current) {
def version; 100 end
def migrate(x)
add_column "people", "last_name", :string
@@ -289,7 +289,7 @@ class MigrationTest < ActiveRecord::TestCase
def test_migrator_one_up_with_exception_and_rollback_using_run
assert_no_column Person, :last_name
- migration = Class.new(ActiveRecord::Migration) {
+ migration = Class.new(ActiveRecord::Migration::Current) {
def version; 100 end
def migrate(x)
add_column "people", "last_name", :string
@@ -310,7 +310,7 @@ class MigrationTest < ActiveRecord::TestCase
def test_migration_without_transaction
assert_no_column Person, :last_name
- migration = Class.new(ActiveRecord::Migration) {
+ migration = Class.new(ActiveRecord::Migration::Current) {
self.disable_ddl_transaction!
def version; 101 end
@@ -525,7 +525,7 @@ class MigrationTest < ActiveRecord::TestCase
if ActiveRecord::Base.connection.supports_advisory_locks?
def test_migrator_generates_valid_lock_id
- migration = Class.new(ActiveRecord::Migration).new
+ migration = Class.new(ActiveRecord::Migration::Current).new
migrator = ActiveRecord::Migrator.new(:up, [migration], 100)
lock_id = migrator.send(:generate_migrator_advisory_lock_id)
@@ -539,7 +539,7 @@ class MigrationTest < ActiveRecord::TestCase
def test_generate_migrator_advisory_lock_id
# It is important we are consistent with how we generate this so that
# exclusive locking works across migrator versions
- migration = Class.new(ActiveRecord::Migration).new
+ migration = Class.new(ActiveRecord::Migration::Current).new
migrator = ActiveRecord::Migrator.new(:up, [migration], 100)
lock_id = migrator.send(:generate_migrator_advisory_lock_id)
@@ -556,7 +556,7 @@ class MigrationTest < ActiveRecord::TestCase
def test_migrator_one_up_with_unavailable_lock
assert_no_column Person, :last_name
- migration = Class.new(ActiveRecord::Migration) {
+ migration = Class.new(ActiveRecord::Migration::Current) {
def version; 100 end
def migrate(x)
add_column "people", "last_name", :string
@@ -577,7 +577,7 @@ class MigrationTest < ActiveRecord::TestCase
def test_migrator_one_up_with_unavailable_lock_using_run
assert_no_column Person, :last_name
- migration = Class.new(ActiveRecord::Migration) {
+ migration = Class.new(ActiveRecord::Migration::Current) {
def version; 100 end
def migrate(x)
add_column "people", "last_name", :string