Permalink
Browse files

Add test cases for Migration#inverse_of

  • Loading branch information...
1 parent a15704d commit c195317a56061593316d7b5d163d868022010132 @aditya-kapoor aditya-kapoor committed Jun 17, 2014
Showing with 17 additions and 0 deletions.
  1. +17 −0 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

0 comments on commit c195317

Please sign in to comment.