The journey to Rails and TDD
-
TDD is a great technique, but may leave you uncertain what exactly to do with the Refactor phase
-
DDD is a good fit here, as it tells us to refactor to the point where our domain understanding is represented in the codebase
-
Rails apps are hard to TDD, so we need to split them
-
Separate the Rails app from the domains part by applying techniques from Rails Refactoring: service objects, form objects, repositories, adapters
-
Separate the frontend from the Rails app, by extracting a React.js based JavaScript application
-
What is left from the Rails app is the domain, but we need to split it into bounded context to easily be able to do TDD
-
Enjoy TDD with Rails! :)
More here
Comments
“Rails apps are hard to TDD” Is it?
If you treat the Rails app as a one big thing, then usually the TDD process is actually about integration tests or end-to-end tests, less about unit testing.
Another approach is to rely heavily on mocks and class-tests, in which the tests are just reflections of the Rails classes - controllers, models etc
Post a comment