diff options
author | Aditya Kapoor <aditya.kapoor@vinsol.com> | 2014-06-17 22:56:01 +0530 |
---|---|---|
committer | Aditya Kapoor <aditya.kapoor@vinsol.com> | 2014-06-17 22:56:01 +0530 |
commit | c195317a56061593316d7b5d163d868022010132 (patch) | |
tree | b5693df294132901109b60ce358c79f24f74183e /activerecord | |
parent | a15704d7f35f17d34d0118546799141d6f853656 (diff) | |
download | rails-c195317a56061593316d7b5d163d868022010132.tar.gz rails-c195317a56061593316d7b5d163d868022010132.tar.bz2 rails-c195317a56061593316d7b5d163d868022010132.zip |
Add test cases for Migration#inverse_of
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/migration/command_recorder_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/command_recorder_test.rb b/activerecord/test/cases/migration/command_recorder_test.rb index a925cf4c05..1c0134843b 100644 --- a/activerecord/test/cases/migration/command_recorder_test.rb +++ b/activerecord/test/cases/migration/command_recorder_test.rb @@ -157,6 +157,23 @@ module ActiveRecord 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 |