Rails Testing Anti-patterns: Domino
I enjoy integration testing Rails applications. Not only because it’s anessential practice, but because I’m too lazy to have to click through anapplication on my browser if I don’t have to. I enjoy clean integration testseven more. My job is very easy when I can jump onto a new project and clearlyunderstand what an integration test is trying to prove.
Recently, I was shown a tool to improve the clarity of tests. The"Domino":https://github.com/ngauthier/domino Rubygem. Domino lets you seperateDOM selectors from your Capybara integration tests, and makes DOM assertionslook like a clean DSL than selector string scattered throughout your tests.
Being a fan of DLS and abstraction, I went bananas writing DSLs with Domino. Butquickly found out that made more work for myself. The following catalogs a fewof these pitfalls, and offer simpler alternatives.
Starting out writing Domino classes, I understood the basics: a domelement has a selecto