Search code examples
ruby-on-rails-4rspec-rails

disable rSpec's auto generated test files


Does anyone know how to disable rspec's auto generated test files on creation of a rails resource ?

I find that I usually clean out most of the default code and would rather start from a clean file every time.


Solution

  • Option #1: If you don't want to generate spec files at all

    Add this to your application.rb file:

    config.generators do |g|
      g.controller_specs false
      g.view_specs false
      g.helper_specs false
      g.routing_specs false
    end
    

    Option #2: If you don't want to generate spec for a specific generator

    rails g scaffold Foo bar:string --no-helper-specs --no-view-specs