bmabey/database_cleaner — pull request #108 by SegFaultAX (2012-03-08 23:23:10+00:00)
Title: Postgresql truncation no table fix

This patch fixes a small bug in the pg truncation adapter. All adapters except pg rely on the `#truncate_tables` method defined in `AbstractAdapter` to iterate through all the tables and truncate each one.

```ruby
def truncate_tables(tables)
tables.each do |table_name|
self.truncate_table(table_name)
end
end
```

If no tables are supplied then no tables can be truncated. The pg adapter defines its own `#truncate_tables` method which doesn't account for an empty list of tables. In the patch I'm simply checking that `tables` is neither nil nor empty before executing the `TRUNCATE TABLE` statement.