Check this rails test out:
def test_remove_column_with_multi_column_index
ActiveRecord::Base.connection.create_table(:hats) do |table|
table.column :hat_name, :string, :limit => 100
table.column :hat_size, :integer
table.column :hat_style, :string, :limit => 100
end
ActiveRecord::Base.connection.add_index "hats", ["hat_style", "hat_size"], :unique => true
assert_nothing_raised { Person.connection.remove_column("hats", "hat_size") }
ensure
ActiveRecord::Base.connection.drop_table(:hats)
end
The file this test came from is chock full of tests written just like this one. What exactly is it testing? The test name implies that it is testing removecolumn when there is a multi-column index. Does the test ensure that removecolumn
Better yet, here's how to make it pass:
def remove_column(*)
end
Tada! No exceptions raised!
This is exactly why minitest doesn't have assert_nothing_raised. You wind up with file after file of useless junk tests.
tenderlove recently converted the rails tests from test/unit to minitest and had to get these tests working since they were all calling assert_nothing_raised. Here is his implementation:
def assert_nothing_raised(*)
yield
end
Certainly easier to do this than to go through all the tests and remove the call (never mind adding real assertions to make sure something is actually being tested).

That's golden!