Published Thursday, March 12, 2015

Note to self:

Bart Simpson chalkboard

Why? Without the --no-test-framework flag, Rails generate will do the following:

a) overwrite any existing tests that you, your colleagues, or your instructors have already written for that particular object

b) generate unnecessary / unwanted tests (see Thoughtbot’s helpful post on diminishing test coverage returns).

Better to write your own tests. Here’s hoping repetition leads to retention…

UPDATE: my classmate Rachel Nackman wrote an excellent blog post on Rails generators, which included an extremely helpful tip for not overwriting tests. Just add the following code to your config/application.rb file:

module Testing
  class Application < Rails::Application
    config.generators.test_framework false

Voila! Your generators are now auto---no-test-frameworked.