aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-08-19 15:55:15 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-08-19 15:55:15 -0300
commit315de6e4904cca63dcce7c91f0d06aa43caf62fb (patch)
tree774bbc5359bea20520c46d7db00e0b1f3123bf8d /activerecord/test/cases
parent48e2b86a507269b5e757106d9accd7b4606333d3 (diff)
parent838e18321118ee3ec6669217e5ea0216f79c969a (diff)
downloadrails-315de6e4904cca63dcce7c91f0d06aa43caf62fb.tar.gz
rails-315de6e4904cca63dcce7c91f0d06aa43caf62fb.tar.bz2
rails-315de6e4904cca63dcce7c91f0d06aa43caf62fb.zip
Merge pull request #16349 from jmcnevin/master
Correctly determine if migration is needed.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/migration_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index 11338e1fb6..f9d1edc340 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -81,6 +81,21 @@ class MigrationTest < ActiveRecord::TestCase
assert_equal 0, ActiveRecord::Migrator.current_version
assert_equal 3, ActiveRecord::Migrator.last_version
assert_equal true, ActiveRecord::Migrator.needs_migration?
+
+ ActiveRecord::SchemaMigration.create!(:version => ActiveRecord::Migrator.last_version)
+ assert_equal true, ActiveRecord::Migrator.needs_migration?
+ ensure
+ ActiveRecord::Migrator.migrations_paths = old_path
+ end
+
+ def test_migration_detection_without_schema_migration_table
+ ActiveRecord::Base.connection.drop_table :schema_migrations
+
+ migrations_path = MIGRATIONS_ROOT + "/valid"
+ old_path = ActiveRecord::Migrator.migrations_paths
+ ActiveRecord::Migrator.migrations_paths = migrations_path
+
+ assert_equal true, ActiveRecord::Migrator.needs_migration?
ensure
ActiveRecord::Migrator.migrations_paths = old_path
end