amatsuda / database_rewinder

minimalist's tiny and ultra-fast database cleaner
MIT License
807 stars 91 forks source link

Partial `before(:all)` compatibility #4

Closed strika closed 10 years ago

strika commented 11 years ago

Adds before(:all) blocks compatibility for simple cases - when RSpec is configured as:

 config.before(:each) do
    DatabaseRewinder.start
  end

  config.after(:each) do
    DatabaseRewinder.clean
  end

and when there is only one before(:all) block on the top. More complex cases, with multiple before(:all) and before(:each) blocks are not supported and I guess fall off the DatabaseRewinder simple philosophy.

deeeki commented 10 years ago

@strika I don't think it's necessary. And your patch seems not to work in nested cases because @inherited_tables aren't stored anywhere. Could you give us a specific example or write a test code?

strika commented 10 years ago

@deeeki I can't. I'm not using DatabaseRewinder actively. And the version I was using is now 9 months old. From what I can remember, DatabaseRewinder didn't work with before(:all) blocks at all. And the patch made it work for our case. But it didn't work if you have mixed before(:all) and before(:each) blocks.

deeeki commented 10 years ago

Thank you for your reply! I see, so I'll close this PR for now. And It would be happy if you try DatabaseRewinder again. :smiley:

strika commented 10 years ago

OK. That sounds reasonable. I'm putting it on the list again. My conclusion back then is that it wasn't stable enough for our test suite. But that might have changed. Cheers.