Rspec Config

in #ruby7 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!

ƪ(˘⌣˘)ʃ

Coin Marketplace

STEEM 0.15
TRX 0.17
JST 0.028
BTC 68754.67
ETH 2469.20
USDT 1.00
SBD 2.37