Although it doesn't appear to be documented you can pass a Proc
as a message. The proc passed will be invoked only on failure.
Example:
def print_db_state
Proc.new { puts DimensionType.all.to_json }
end
describe "import stuff"
it "should import correctly"
imported_count = import_stuff()
assert_equal 3, imported_count, print_db_state
end
end
Passing ImportedStuff.all.to_json
will invoke all.to_json
every time the assertion is executed even if the test doesn't fail - not good.