bmabey/database_cleaner — pull request #127 by stanislaw (2012-07-08 19:22:50+00:00)
Title: RSpec2 upgrade, Faster :truncation strategy, design to test real db interactions (for AR), already working travis setup. (mainly addresses #126)

1. 'Shared example group 'a generic strategy' already exists'.

See https://www.relishapp.com/rspec/rspec-core/docs/example-groups/shared-examples

If shared examples are in a separate file, it should be named *.rb, not
_spec.rb. This was the problem of double inclusion.

2. I did an upgrade to RSpec2.

3 of 4 specs are failing because of I don't have MongoDB, and right now
it is not an easy task to install it because of messy dependendencies my
Gentoo version has.

About the fourth failing spec - configuration_spec#210 - it seems to me that its flow is broken. Please, check carefully what you test there.

3. lib/database_cleaner/active_record/truncation.rb

See the pieces of code for MySQL and MySQL2 and PostgreSQL adapters: they look very
similar at first glance, but notice the difference how 'mysql' and
'mysql2' gem handle parsing of results - each gem does it its own way. PostgreSQL fast truncation methods in their turn operate on groups of tables, while MySQL and MySQL2 operate each on one table. By exposing this, I just mean, that it is hard to write some common code they all reuse. I think it is up to you to decide, whether fast truncation methods deserve their own module in fx:
lib/database_cleaner/active_record/fast_truncation.rb, like

```ruby
module DatabaseCleaner
module ActiveRecord
module FastTruncation
module MySQL
module MySQL2
module PostgreSQL
# ...
```

4. I made additional option :fast. Let's take some time for testing fast
truncation among the users which will like to try it. Also, it is good to have
it as an option, to just compare performance thus timing advantage, when
running large test suites! After you gather feedback from developers,
who succeeded using it, you can easily remove :fast option, making the
fast strategy used by default.

5. Travis

You need:

Go on http://travis-ci.org/ - an sign in there with your github account,
then visit your 'Profile' page, then toggle into on your sugar-high
repository.

Then go to the 'home' page, 'My repositories' tab there and see if
database_cleaner appeared to begin doing builds.

Also here: https://github.com/bmabey/database_cleaner/hooks you will
see that travis hook activated - click on it - then to press "Test hook"
to begin doing first build.

Remember, that I've already added status image that points to sugar-high
on travis-ci.org. It is not displayed before you enable sugar-high on
travis.