picardo
picardo

Reputation: 24886

Disable generation of requests and routing specs? [RSPEC]

Whenever I generate a scaffold, Rspec generator always creates specs like the following:

  invoke    rspec
  create      spec/controllers/stars_controller_spec.rb
  invoke      helper
  create      spec/routing/stars_routing_spec.rb
  invoke      rspec
  create        spec/requests/stars_spec.rb

How can I make sure that these are never generated? I tried setting configuration settings like this, but it didn't help:

  config.generators do |g|
   g.test_framework :rspec, :fixture => true, :views => false
   g.view_specs false
   g.integration_specs false
   g.helper_specs false
  end

Upvotes: 15

Views: 4090

Answers (2)

notapatch
notapatch

Reputation: 7173

How can you find these options?

Documentation can be out of date. However, the list of options can be found in RSpec Rails library.

class_option :controller_specs, type: :boolean, default: false, desc: "Generate controller specs"
class_option :request_specs,    type: :boolean, default: true,  desc: "Generate request specs"
class_option :view_specs,       type: :boolean, default: true,  desc: "Generate view specs"
class_option :helper_specs,     type: :boolean, default: true,  desc: "Generate helper specs"
class_option :routing_specs,    type: :boolean, default: true,  desc: "Generate routing specs"

Upvotes: 2

David Chelimsky
David Chelimsky

Reputation: 9000

config.generators do |g|
  g.test_framework :rspec,
    :view_specs    => false,
    :request_specs => false,
    :routing_specs => false
end

ps - see the docs for more info.

Upvotes: 25

Related Questions