diff options
author | Matthew Draper <matthew@trebex.net> | 2014-06-18 07:38:32 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-06-18 07:38:32 +0930 |
commit | 5a7784afa66a9b84750dc0c062e7a9ae3e670cbc (patch) | |
tree | b18f03783d9b6cf4b9afc2e1c0e3c33bb61912c7 /activerecord | |
parent | 9f86780226c86fae30d59d04bd53449b8c7a1ad8 (diff) | |
parent | c195317a56061593316d7b5d163d868022010132 (diff) | |
download | rails-5a7784afa66a9b84750dc0c062e7a9ae3e670cbc.tar.gz rails-5a7784afa66a9b84750dc0c062e7a9ae3e670cbc.tar.bz2 rails-5a7784afa66a9b84750dc0c062e7a9ae3e670cbc.zip |
Merge pull request #15727 from aditya-kapoor/add-tests-for-migration
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 |