RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

The journey to Rails and TDD

  1. TDD is a great technique, but may leave you uncertain what exactly to do with the Refactor phase

  2. DDD is a good fit here, as it tells us to refactor to the point where our domain understanding is represented in the codebase

  3. Rails apps are hard to TDD, so we need to split them

  4. Separate the Rails app from the domains part by applying techniques from Rails Refactoring: service objects, form objects, repositories, adapters

  5. Separate the frontend from the Rails app, by extracting a React.js based JavaScript application

  6. 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

  7. 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

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in