aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorschneems <richard.schneeman@gmail.com>2017-01-06 13:30:42 -0600
committerschneems <richard.schneeman@gmail.com>2017-01-06 13:30:42 -0600
commit93ee268ef40b052497daf22f124fc1535acabd64 (patch)
treeb76ce1819cf2bedfdd3e10f73d0a23837d708f23 /activerecord/test
parent98c6e4e56ca2a8f9f987e12815f7cdf66e5f1485 (diff)
downloadrails-93ee268ef40b052497daf22f124fc1535acabd64.tar.gz
rails-93ee268ef40b052497daf22f124fc1535acabd64.tar.bz2
rails-93ee268ef40b052497daf22f124fc1535acabd64.zip
Preserve `up` and `down` return type
In Rails 4.2 calling `ActiveRecord::Migrator.migrate` would return an array of results. Without realizing that this return type was expected I accidentally introduced a change in https://github.com/rails/rails/commit/4d60e93174a3d6d90b1a06fc7515cb5cd749a6f3 This PR preserves the previous behavior and adds a test on the return type. This will need a backport to 5.0 branch.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/migrator_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/migrator_test.rb b/activerecord/test/cases/migrator_test.rb
index bb9835394b..cb44c443c7 100644
--- a/activerecord/test/cases/migrator_test.rb
+++ b/activerecord/test/cases/migrator_test.rb
@@ -290,6 +290,20 @@ class MigratorTest < ActiveRecord::TestCase
assert_equal [[:up, 1], [:up, 2], [:up, 3]], calls
end
+ def test_migrator_output
+ _, migrator = migrator_class(3)
+
+ result = migrator.migrate("valid")
+ assert_equal(3, result.count)
+
+ # Nothing migrated from duplicate run
+ result = migrator.migrate("valid")
+ assert_equal(0, result.count)
+
+ result = migrator.rollback("valid")
+ assert_equal(1, result.count)
+ end
+
def test_migrator_rollback
_, migrator = migrator_class(3)