Skip to content

Commit

Permalink
Merge pull request #15727 from aditya-kapoor/add-tests-for-migration
Browse files Browse the repository at this point in the history
Add test cases for Migration#inverse_of
  • Loading branch information
matthewd committed Jun 17, 2014
2 parents 9f86780 + c195317 commit 5a7784a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions activerecord/test/cases/migration/command_recorder_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit 5a7784a

Please sign in to comment.