back home

Making specs better and other links

Today couple of links that hopefully will make specs better.

Here's two in one - a nice blog post about using metadata in your specs to drive different behavior like cleaning a database, plus a good example of setting up database cleaner.

Ever wondered how to test Rails generators in your gem? Here's a good article on this topic.

Using database cleaner? You should probably consider using deletion strategy. But you mileage may vary - in our project it didn't yield any performance gains.

And here's some interesting alternative to database cleaner - database flusher. Author claims it to be faster, haven't checked it out yet.

Here's a small speed up for Rails 5 (if you haven't upgraded yet to 5.0.2). Seems template views are recompiled in tests every request, that sounds slow!

Using rspec parts in your code - I like the idea of using matchers for better case ... when but mocking and other unholy tricks - that's 💩