davidpm avatar

Rspec Config

davidpm

Published: 05 Mar 2018 › Updated: 05 Mar 2018Rspec Config

Rspec Config

You've included rspec in your Gemfile, run bundle install and you want to initialize some examples to start testing.

> rails g rspec:install

The thing is you are sick of all the extras that come along with the rails/rspec generators. You don't want views, helpers, javascript files, etc.

Quickie

All you need to do is add some light configuration options. Open config/application.rb:

> vim config/application.rb

Now, inside of the Application class, enter the following configuration options by passing a block into config.generators:

config.generators do |g|
  g.test_framework :rspec, fixture: false
  g.view_specs false
  g.helper_specs false
  g.stylesheets = false
  g.javascripts = false
  g.helper = false
end

As you can see, we have established our test framework, disabled fixtures, view specs, helper specs, stylesheets, javascripts, and helper. Now, when you generate your next controller, model, or resource you wont get a bunch of pesky files that you'll just end up having to delete!

ƪ(˘⌣˘)ʃ

Leave Rspec Config to:

Written by

quick posts about programming

Read more #ruby posts


Best Posts From davidpm

We have not curated any of davidpm's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From davidpm