16

I want to configure rpsec-rails generators so that I can for example disable view and controller tests or manually replace fixtures with factories. I read the documentation, blog posts and ask questions on rspec IRC channel, but I found no good answer. suppose I want to disable the view specs. I should do something like:

config.generators do |g|
  g.test_framework :rspec,
    views: false
end

My question is where can I find list of all available option like 'views'?

1 Answer 1

20

Here is the list of all options which I know for Rspec:

config.generators do |generate|
  generate.test_framework  :rspec,
        fixtures: true,
        view_specs: false,
        helper_specs: false,
        routing_specs: false,
        controller_specs: false,
        request_specs: false
   generate.fixture_replacement :factory_girl, dir: "spec/factories"
end

Example with a friendly sintax for rails 5.++

# config/application.rb
config.generators do |g|
  g.test_framework :rspec
  g.helper_specs false
  g.controller_specs false
  g.view_specs false
  g.routing_specs false
  g.request_specs false
end

The list of options can be found in RSpec Rails library.

Sign up to request clarification or add additional context in comments.

2 Comments

That is what Aaron Sumner says in his book and blog, too. But where did you or Aaron find these options? These are not well documented.
Here is where these options are currently defined in the code: github.com/rspec/rspec-rails/blob/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.