Rspec Config

in ruby •  7 years ago 

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!

ƪ(˘⌣˘)ʃ

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!