Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #15727 from aditya-kapoor/add-tests-for-migration

Add test cases for Migration#inverse_of
  • Loading branch information...
commit 5a7784afa66a9b84750dc0c062e7a9ae3e670cbc 2 parents 9f86780 + c195317
@matthewd matthewd authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 activerecord/test/cases/migration/command_recorder_test.rb
View
17 activerecord/test/cases/migration/command_recorder_test.rb
@@ -157,6 +157,23 @@ def test_invert_add_column
assert_equal [:remove_column, [:table, :column, :type, {}], nil], remove
end
+ def test_invert_change_column
+ assert_raises(ActiveRecord::IrreversibleMigration) do
+ @recorder.inverse_of :change_column, [:table, :column, :type, {}]
+ end
+ end
+
+ def test_invert_change_column_default
+ assert_raises(ActiveRecord::IrreversibleMigration) do
+ @recorder.inverse_of :change_column_default, [:table, :column, 'default_value']
+ end
+ end
+
+ def test_invert_change_column_null
+ add = @recorder.inverse_of :change_column_null, [:table, :column, true]
+ assert_equal [:change_column_null, [:table, :column, false]], add
+ end
+
def test_invert_remove_column
add = @recorder.inverse_of :remove_column, [:table, :column, :type, {}]
assert_equal [:add_column, [:table, :column, :type, {}], nil], add
Please sign in to comment.
Something went wrong with that request. Please try again.