bmabey/database_cleaner — pull request #191 by johnhampton (2013-03-18 16:23:59+00:00)
Title: Call transaction before calling rollback_transaction_records

Running non-database related tests before any database related tests have been run results in the following exception:

```
Failure/Error: Unable to find matching line from backtrace
NoMethodError:
undefined method `flatten' for nil:NilClass
# ./vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/database_statements.rb:348:in `rollback_transaction_records'
# ./vendor/bundle/ruby/1.9.1/bundler/gems/database_cleaner-8002b4695602/lib/database_cleaner/active_record/transaction.rb:36:in `clean'
# ./vendor/bundle/ruby/1.9.1/bundler/gems/database_cleaner-8002b4695602/lib/database_cleaner/base.rb:77:in `clean'
# ./vendor/bundle/ruby/1.9.1/bundler/gems/database_cleaner-8002b4695602/lib/database_cleaner/configuration.rb:79:in `block in clean'
# ./vendor/bundle/ruby/1.9.1/bundler/gems/database_cleaner-8002b4695602/lib/database_cleaner/configuration.rb:79:in `each'
# ./vendor/bundle/ruby/1.9.1/bundler/gems/database_cleaner-8002b4695602/lib/database_cleaner/configuration.rb:79:in `clean'
```

If the protected method `rollback_transaction_records` is called before transaction has been called at least once, the `@_current_transaction_records` instance variable will be uninitialized. This results is an exception when clean attempts to call `rollback_transaction_records`.